Date: 27 Apr 1997 06:12:36 +0100 From: Andrew Gierth <andrew@erlenstar.demon.co.uk> To: Curt Sampson <cjs@portal.ca> Cc: hackers@freebsd.org Subject: Re: /etc/netstart bogons.. Message-ID: <874tctkq0r.fsf@erlenstar.demon.co.uk> In-Reply-To: Curt Sampson's message of Sat, 26 Apr 1997 21:47:32 -0700 (PDT) References: <Pine.NEB.3.93.970426214717.24845C-100000@gnostic.cynic.net>
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Curt" == Curt Sampson <cjs@portal.ca> writes: >> Can't let this slip past: "" and unset are certainly not the same in sh. Curt> So how do we test for the difference between the two? $ sh $ if [ -z "${var+X}" ]; then echo "variable 'var' is not set"; fi variable 'var' is not set $ var='' $ if [ -z "${var+X}" ]; then echo "variable 'var' is not set"; fi $ Or, if you want "unset" to be treated like "NO", then $ unset var $ echo "value is '${var-NO}'" value is 'NO' $ var='' $ echo "value is '${var-NO}'" value is '' $ var='foo' $ echo "value is '${var-NO}'" value is 'foo' $ -- Andrew.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?874tctkq0r.fsf>