Source-Changes-D archive

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

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.

Although posix defines strict rules for expressions with small
numbers of arguments, netbsd'd parser doesn't obey them!

> as well as using unquoted variables
> which will break for strings with whitespace.

Sometimes I empty IFS....

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index