> [ -n ] && echo "bug"
>
> will print "bug".
As it should.
> I'd have expected [ -n ] would be the same as [ -n "" ]...
Bad expectation.
> (Affects the variants thereof, as well, e.g.
> unset FOO
> [ -n $FOO ] && echo "bug")
Bad programming practice.
Look at question E1 in the Bash FAQ for an explanation. Equivalent
text appears in the bash man page.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/