[ILUG] POTD reminder

kevin lyda kevin+dated+1103395530.c42a1f at ie.suberic.net
Mon Dec 13 18:45:16 GMT 2004


On Mon, Dec 13, 2004 at 05:31:45PM +0000, P at draigBrady.com wrote:
> kevin lyda wrote:
> > it's better if you do the following:
> > 
> >     if [ X"$str" = X"1" ] || [ "$int" -eq "1" ]; then
> >         echo "str or int is 1"
> >     elif [ "$int" -lt "10" ] && [ -e "file" ]; then
> >         echo "int less than 10 and file exists"
> >     fi
> > 
> > that way if $str begins with a - it won't annoy test.
> Apart from that X"$str" trick looking horrible,
> it's unecessary from my testing. test and the
> builtin [ seem to be clever enough to parse options
> only when appropriate.

on linux, yes. but not on all versions of test sadly.

kevin

-- 
kevin lyda                    Every gun that is made, every warship launched,
kevin at ie.suberic.net          every rocket fired signifies, in the final
http://ie.suberic.net/~kevin/ sense, a theft from those who hunger and are
Dwight Eisenhower, 1953 ----> not fed, those who are cold and are not clothed.



More information about the ILUG mailing list