Re^2: Bourne Shell: Variable defined?
Maarten Litmaath
maart at cs.vu.nl
Thu Mar 23 04:13:46 AEST 1989
gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
\In article <1819 at umbc3.UMBC.EDU> rostamia at umbc3.UMBC.EDU (Rouben Rostamian) writes:
\>In C Shell the variable $?foo returns true or false (0 of 1, really)
\>depending on whether or not the variable "foo" has been already defined.
\ if [ X"$foo" = X ]
\ then : # doesn't exist or is an empty string
The question was: "Has it been defined?"
Ergo, if $foo is an empty string, it IS defined and your test fails.
--
Modeless editors and strong typing: |Maarten Litmaath @ VU Amsterdam:
both for people with weak memories. |maart at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list