[Toybox] is orthodoxy a strong value of toybox?

Marc Chantreux mc at unistra.fr
Thu Sep 1 13:33:02 PDT 2022


hello,

> No, it'll be what the Linux command line needs. Posix is insufficient, it

thanks for correcting me on that.

> https://github.com/landley/toybox/blob/master/toys/posix/sed.c#L14

nice!

> Bash does not accept non-compound commands, and toysh is using "what bash does"
> as its standard. On debian:

oh ... this is sad but ok.

> > 	<<\. toys
> > 	for shell in zsh dash mksh oksh 'busybox sh' yash toys; do
> > 		$shell -c "f() echo $shell does; f"
> > 	done

> So you tried everything _except_ bash.

this is because to me, choosing a shell about features and weight.

which dash mksh oksh yash zsh bash|xargs realpath|xargs ls -s|sort -nr

1208 /bin/bash
 864 /bin/zsh
 400 /usr/bin/yash
 288 /bin/mksh
 284 /bin/oksh
 124 /bin/dash

* there is a lot of lovely things in zsh: excellent as interactive shell
* all the others are at least 50% the size of bash and good enough for
  99% of the scripts

so bash is something I just avoided for 2 decades now and I'm just happy
this way. plus: it needs compound command to declare a function ;)

> > If I want that feature, I need a first external dependency (i'll
> > probably choose rc or [om]ksh) but is orthodoxy a strong value of toybox?
> I don't know what you mean by orthodoxy in this context.

orthodoxy meant "keep staying straight to the doxa" (french people use this word
in its etymological sense, sorry if it's not the case in english) and I
though yours was "POSIX only things" (false memory from your "busybox vs
toybox" talk).  I was wrong: sorry about that.

> It's not hard to add, I literally didn't because bash didn't. No deeper reason.

Because of bash, many people don't know the fact that every other shell
does support it but it seems everyone I shown the tips just liked it.

> Hey Chet: why doesn't bash accept non-compound commands as functions? I have
> wondered. Apparently other shells disagree on this...?

Chet: if you're involved in bash developpement and don't bother replying to
me: I'm really curious about why the bash binary is so big (compared to
zsh, for example, which has a lot of cool features stolen from rc, tcsh
and all the others I already mentioned)

thanks
-- 
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200


More information about the Toybox mailing list