TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:2032] confused with bash script
> You can change that by replacing your iffs with something like:
> if [ "a$datafile" = "a$QUERY" ]
>
> that way even if datafile or QUERY are null/blank strings the expression will
> evaluate
> to at leaset "a" = "a".
Umm.. Can't you just do a simple thing like this:
#!/bin/sh
QUERY=something
#datafile="" ; So 'datafile' doesn't get set at all..
if [ "$datafile" = "$QUERY" ]; then
echo Yep.
else
echo Nope.
fi
effectively testing ( "" = "something" )
Seems to work on my system.. But maybe I'm weird.. ;-)
--
--== Mike Hicks ==--
http://umn.edu/~hick0088 mailto:hick0088@tc.umn.edu
ICQ:6883760
Linux User Since 1.2.13 Current Kernel: 2.1.125