[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /bin/sh diversions

Pierre Habouzit dixit:

>>     https://bugs.launchpad.net/ubuntu/+source/dash/+bug/61463

This is just clueless script writers and general whining; these
issues could be fixed one by one. (Actually, even with current
Debian policy, they're bugs.)

>  * [[ for test, trivial: add it as a test alias, and also check for ]]
>    termination in the test.c builtin.

There's quite some difference though: -a and -o become && and ||,
\! doesn't work (operators have to be unquoted), the single-argument
form [ $foo ] is not supported (use [[ -n $foo ]]), variables are
not expanded, etc. - see http://www.mirbsd.org/man1/mksh.htm or the
AT&T ksh documentation ([[ is originally a Korn shell feature).

>  * echo -e: trivial to implement in the printf.c builtin.

People who still use echo in portable scripts should be shot anyway ☺☻
but this one is so common that I'd actually agree this could be supported.

>  * { } globbing, dash uses the glibc's glob, so it's just a matter of
>    adding | GLOB_BRACE to the flags.

This csh-style globbing is enabled in some shells by "set -o braceexpand",
and some scripts (such as NetBSD's build.sh) explicitly turn it off; enab-
ling it by default could be dangerous (as they use "case $KSH_VERSION in…"
for checking if to disable it - who knows who else...).

>  Maybe source (for .) could be added

Where does that one come from anyway? I haven't seen it in Korn shell…

I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence.		-- Coywolf Qi Hunt

Reply to: