From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-users@sunsite.auc.dk
Subject: Re: Parameter expansion
Date: Mon, 17 May 1999 11:23:22 +0200 [thread overview]
Message-ID: <9905170923.AA28440@ibmth.df.unipi.it> (raw)
In-Reply-To: "Roland Jesse"'s message of "Mon, 17 May 1999 11:39:18 DFT." <14143.58310.693584.42423@busch.cs.uni-magdeburg.de>
Roland Jesse wrote:
> But why do I do get the following than?
>
> % if [ ! ${+BLURB} ]; then
> then> echo "BLURB not set"
> then> else
> else> echo "BLURB set"
> else> fi
> BLURB set
> %
That's becuase
% if [ ! 0 ]; then print no; else print yes; fi
yes
% if [ ! 1 ]; then print no; else print yes; fi
yes
It's testing whether the string has length zero, which it doesn't. You
need arithmetical evaluation; change the [ to (( and the ] to )) and
everything should work.
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
next prev parent reply other threads:[~1999-05-17 9:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-17 9:39 Roland Jesse
1999-05-17 9:23 ` Peter Stephenson [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-08-13 22:58 Parameter Expansion Clint Priest
2017-08-13 23:51 ` Bart Schaefer
2017-08-14 0:07 ` Bart Schaefer
2017-08-14 1:16 ` Clint Priest
1999-03-31 14:35 Parameter expansion Mircea Damian
1999-03-31 14:54 ` Geoff Wing
1999-03-31 15:04 ` Mircea Damian
1999-03-31 15:51 ` Bart Schaefer
1999-04-01 6:20 ` Rob Hooft
1999-04-01 7:30 ` Geoff Wing
1999-04-01 7:33 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9905170923.AA28440@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).