From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id EAA22639 for ; Tue, 11 Jun 1996 04:28:53 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA27672; Mon, 10 Jun 1996 14:16:40 -0400 (EDT) Resent-Date: Mon, 10 Jun 1996 14:16:40 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199606101817.UAA06663@bolyai.cs.elte.hu> Subject: Re: Is this really correct ? To: hniksic@srce.hr (Hrvoje Niksic) Date: Mon, 10 Jun 1996 20:17:24 +0200 (MET DST) Cc: zsh-workers@math.gatech.edu, gene@bear.com In-Reply-To: from Hrvoje Niksic at "Jun 10, 96 07:42:44 pm" Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL16 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"MK_1I3.0.Em6.8Q6ln"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1313 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > gene@bear.com (gene@bear.com) wrote: > > > > > > Hpux 9.05. > > > > % echo $ZSH_VERSION > > 2.6-beta20 > > % a="-s"; if [ "$a" = "-s" ] ; then echo "yeh" ; fi > > % > > > > (if fails) > > If $a is -s, then the test builtin probably tests for whether file '=' > exists and has a size greater than zero :-). This works for me: > $ echo hi > = > $ a="-s"; if [ "$a" = "-s" ] ; then echo "yeh" ; fi > yeh > > Thus, it may be an sh incompatibility, but not a bug. Unless the shell > is supposed to count the arguments first, and then use draw the > conclusions according to the argument values (in which case the middle > argument would recognized as two-operand =). POSIX 1003.2 says that if test has three arguments and $2 is a binary operator then perform the binary test of $1 and $3. If $1 is `!', negate the two-argument test of $2 and $3. Otherwise, produce unspecified results. Zsh will be modified according to this (which is more logical than the present behaviour). Zoltan