dash

Rocco Stanzione grasshopper at linuxkungfu.org
Thu Sep 14 22:18:46 BST 2006


On Thursday 14 September 2006 15:14, Scott James Remnant wrote:
[snip]
> > [[ is not POSIX.
>
> Indeed, to quote the URL _you_ gave again:
>
> 	The KornShell-derived conditional command
> 	(double bracket [[]]) was removed from the shell
> 	command language description in an early proposal.

My mistake.  I misinterpreted:
[ [expression] ]
near the top of the page, under Synopsis.

That reduces my argument to what it was before trying to find info on what 
POSIX had to say about it: that bash has proliferated so much, for so long, 
as the target of /bin/sh that the expectation has proliferated with it, not 
only in shell scripts that mistakenly say #!/bin/sh but in Makefiles (as in 
iptables, and GNU make doesn't inherit the SHELL variable - it's /bin/sh) 
where it's apparently also a mistake to use non-POSIX-compliant shell 
language, and likely in other places as well.

Again, in Ubuntu packages, scripts (and Makefiles) can be and have been fixed 
to accommodate dash, but 3rd party applications not packaged by Ubuntu don't 
have this benefit and can be hard to diagnose when they break.  To complicate 
matters, even if you think you've fixed a problem by changing #!/bin/sh to 
#!/bin/bash at the top of a script, bash (still the default user shell) has 
cached sh as the way to call the script, and it will fail in the same way 
until you say something like "bash /path/to/script".

So, my opinion is that dash-as-sh is not worth the real and potential problems 
it causes.  I've only ever thought bash was slow-ish as a login shell, and 
that was due to bash-completion and my somewhat heavy .bashrc, and these 
aren't issues when running shell scripts.  Picking a few scripts basically at 
random and timing them with bash vs. dash, the biggest difference I've seen 
is 2ms, and those differences disappear altogether if I time them from within 
dash.

Thanks,

Rocco



More information about the ubuntu-devel mailing list