On Sep 20, 8:14pm, da...@l8s.co.uk (David Laight) wrote: -- Subject: Re: CVS commit: src/distrib
| On Sat, Sep 19, 2009 at 09:05:27PM +0000, Christos Zoulas wrote: | > | > if [ -n "$1" ]; then | > awk -f .../list2sh.awk "$@" | > fi | | Since "$@" is being substituted, wouldn't a check against $# | be more appropriate? | | > and that "X$1" idiom needs to die | | It is necessary to guarantee the way the expression is evaluated | if/when $1 (in the above example) is, say, "-o" or some other string | that might be deemed to be an operator. if [ -n -o ]; then echo true; else echo false; fi works just fine. | Although posix defines strict rules for expressions with small | numbers of arguments, netbsd'd parser doesn't obey them! Really? Can you give me an example. | > as well as using unquoted variables | > which will break for strings with whitespace. | | Sometimes I empty IFS.... Heh, christos