zsh-users
 help / color / mirror / code / Atom feed
* Problems with Parameter Expansion :=
@ 2001-02-14 20:28 Heinrich Götzger
  2001-02-14 20:56 ` Bart Schaefer
  2001-02-14 22:11 ` Thomas Köhler
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Götzger @ 2001-02-14 20:28 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-02-14 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-14 20:28 Problems with Parameter Expansion := Heinrich Götzger
2001-02-14 20:56 ` Bart Schaefer
2001-02-14 22:11 ` Thomas Köhler

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).