Source-Changes-D archive

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

Re: CVS commit: src/distrib



On Sep 20,  8:14pm, david%l8s.co.uk@localhost (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


Home | Main Index | Thread Index | Old Index