Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is this really correct ?
- X-seq: zsh-workers 1313
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: hniksic@xxxxxxx (Hrvoje Niksic)
- Subject: Re: Is this really correct ?
- Date: Mon, 10 Jun 1996 20:17:24 +0200 (MET DST)
- Cc: zsh-workers@xxxxxxxxxxxxxxx, gene@xxxxxxxx
- In-reply-to: <kigbuirlfmz.fsf@xxxxxxxxxxxxx> 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
> gene@xxxxxxxx (gene@xxxxxxxx) 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author