[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
test -n "${var+set}"?
From: |
Derek Robert Price |
Subject: |
test -n "${var+set}"? |
Date: |
Tue, 17 Feb 2004 19:13:02 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey all,
Just wondering what the logic behind all the constructs like, `test
"${var+set} = set', was in recently generated configure scripts. Is it
just a carryover from the old days when someone on the autoconf team
thought test -n/-z wasn't portable? Is it just someone's preference?
Is this construct overkill: `if test -n "${ZSH_VERSION+set}"'?
All I could find in the Autoconf manual was the following:
Contrary to a common belief, `test -n STRING' and `test -z STRING'
*are* portable. Nevertheless many shells (such as Solaris 2.5,
AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4 etc.) have bizarre
precedence and may be confused if STRING looks like an operator:
$ test -n =
test: argument expected
Does this mean that if $var EXPANDS to `=' that some shells will break?
Or does the `=' need to be a literal?
Trying to write shell portably,
Derek
- --
*8^)
Email: address@hidden
Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org
iD8DBQFAMq4NLD1OTBfyMaQRAqJgAKDVdwP7FuIIZlrDssoHM0hKLFBgswCeLJvK
oUB3L4LKVf/+63i1LujU3TE=
=Q8vJ
-----END PGP SIGNATURE-----