From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13916 invoked from network); 14 Feb 2001 20:56:29 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Feb 2001 20:56:29 -0000 Received: (qmail 11382 invoked by alias); 14 Feb 2001 20:56:19 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3618 Received: (qmail 11371 invoked from network); 14 Feb 2001 20:56:16 -0000 From: "Bart Schaefer" Message-Id: <010214125608.ZM1498@candle.brasslantern.com> Date: Wed, 14 Feb 2001 12:56:08 -0800 In-Reply-To: Comments: In reply to Heinrich Go%tzger "Problems with Parameter Expansion :=" (Feb 14, 9:28pm) References: X-Mailer: Z-Mail Lite (5.0.0 30July97) To: , Heinrich Go%tzger Subject: Re: Problems with Parameter Expansion := MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 14, 9:28pm, Heinrich Go%tzger wrote: > Subject: Problems with Parameter Expansion := > > if [ ${NAME1:=""} = "true" ] > then > echo "true" > fi > $ . script.sh > odin > script.sh:6: parse error: condition expected: = > > Why does it not expand NAME1 to "" ? We've actually just been having a discussion about this on zsh-workers. ${NAME1:=""} sets NAME1 to the empty string and then substitutes the resulting value of $NAME1, which is exactly what the zsh docs say it will do. Bourne shell and ksh, however, set NAME1 to the empty string and then substitute the empty string, which is not the same thing. The most straightforward thing that will work in all of sh/ksh/zsh is if [ "${NAME1:=''}" = "true" ] so that the entire ${...} is quoted.