choice of control operators in scripts

Paul Fox pgf at brightstareng.com
Thu May 15 00:20:38 UTC 2008


 > You're talking again of som general case.  In this particular case:
 > 
 >   [ x"$foo" != x ]
 > 
 > it's totally useless quoting an empty string after the 'x' on the
 > right side of the condition.


sigh.  why would you write this at all?  either say what you
mean, and write:
    [ "$foo" != "" ]

or say it in the usual shell idiom and write:
    [ "$foo" ]
or
    [ -n "$foo" ]

but this
    [ x"$foo" != x ]
or this
    [ x"$foo" != x"" ]

are just silly.

paul
=---------------------
 paul fox, pgf at brightstareng.com



More information about the busybox mailing list