On Mon, Sep 08, 2003 at 11:11:34AM +0200, Andreas Metzler wrote:
> > I do continue to think that:
>
> > if [ -n "$var" ]
>
> > is more readable than
>
> > if [ "${var+set}" = "set" ]
>
> I agree, but usually use »[ "x${var}" != "x" ]« for no particular
> reason but the fact that when reading it later I can discern its
> purpose much faster than test -n or just [ "$var" ].
By "readable", I mean exactly "ease of discerning purpose".
My proposed method *is* the idiomatic way of using test(1) to check for
a non-null value. I don't defend test(1) as a miracle of clarity,
though. -h is a synonym for -L. Go figure. :-/
--
G. Branden Robinson | To Republicans, limited government
Debian GNU/Linux | means not assisting people they
branden@debian.org | would sooner see shoveled into mass
http://people.debian.org/~branden/ | graves. -- Kenneth R. Kahn
Attachment:
pgpebzGVFXXos.pgp
Description: PGP signature