Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Problems with Parameter Expansion :=
- X-seq: zsh-users 3616
- From: Heinrich Götzger <goetzger@xxxxxxx>
- To: <zsh-users@xxxxxxxxxxxxxx>
- Subject: Problems with Parameter Expansion :=
- Date: Wed, 14 Feb 2001 21:28:04 +0100 (MET)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Reply-to: Heinrich Götzger <goetzger@xxxxxxx>
- Sender: <goetzger@xxxxxxxxxxxxxxxxxxxxxxxx>
Hi there again,
my second problem is that I want to set NAME to WORD,
if NAME is not set, example from zsh.info:
${NAME:=WORD}
my script (called script.sh):
-- begin --
if [ ${NAME:=`hostname | cut -c5-8`} ]
then
echo $NAME
fi
if [ ${NAME1:=""} = "true" ]
then
echo "true"
fi
-- end --
asuming, my hosts name is exploding:
$ echo $NAME
zsh: NAME: parameter not set
$ echo $NAME1
zsh: NAME1: parameter not set
$ . script.sh
odin
script.sh:6: parse error: condition expected: =
Again, it runs with bash and ksh.
Why does it not expand NAME1 to "" ?
running it with set -x it shows:
$ . script.sh
+-zsh:8> . script.sh
+script.sh:1> [ odin ]
+script.sh:3> echo odin
odin
+script.sh:6> [ = true ]
script.sh:6: parse error: condition expected: =
Any ideas?
Thanks for our help.
Regards
Heinrich
Messages sorted by:
Reverse Date,
Date,
Thread,
Author