If $1 = "" I get an error, Help:-)

Steve Friedl friedl at mtndew.Tustin.CA.US
Mon Oct 8 16:09:15 AEST 1990


> Enclose the $1 in "s:
> 
>            if [ "$1" = "" ]
> 

While this handles the null input case properly, it can get confused
if the variable contains one of the magic tokens for test (say, "-x"
or "!").  Better is to de-magify [?] the variable with:

             if [ x"$1" = x"" ]

so you don't get the potential surprise.

     Steve

-- 
Stephen J. Friedl, KA8CMY / I speak for me only / Tustin, CA / 3B2-kind-of-guy
+1 714 544 6561  / friedl at mtndew.Tustin.CA.US  / {uunet,attmail}!mtndew!friedl

"No job is too big, no fee is too big" - Gary W. Keefe's company motto



More information about the Comp.unix.questions mailing list