choice of control operators in scripts
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Mon May 12 20:51:13 UTC 2008
On Mon, 12 May 2008, Denys Vlasenko wrote:
> On Monday 12 May 2008 14:29, Paul Smith wrote:
> >
> > You can replace both these lines with:
> >
> > NAME="${1:-$2}"
>
> This will make me to go read "man bash".
Me perfers "man dash". It's so much more compact. And ash competes with
dash, not bash. The comment at the bottom of bash man psge:
,----
| BUGS
| It's too big and too slow.
`----
should scare more than one person ;)
> Not that I remember what -n and -z mean... I strongly prefer obvious:
>
> [ "$foo" = "bar" ]
>
> If you fell paranoid today (highly recommended),
> add x"" to guard against less than ideal implementations of []
> which can be confused by e.g. foo=-n :
>
> [ x"$foo" = x"bar" ]
I have no experience of shells that are _so_ buggy. Do you mean this:
[ x-n = xbar ]
might confuse any non-buggy shell? And by the way, why not use ash as the
shell for the tests?
Cheers,
--
Cristian
More information about the busybox
mailing list