zsh-workers
 help / color / mirror / code / Atom feed
* Is this really correct ?
@ 1996-06-10 17:21 gene
  1996-06-10 17:42 ` Hrvoje Niksic
  0 siblings, 1 reply; 3+ messages in thread
From: gene @ 1996-06-10 17:21 UTC (permalink / raw)
  To: zsh-workers


   Hpux 9.05.

% echo $ZSH_VERSION
2.6-beta20
% a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi 
% 

(if fails)


  Way older version:
% echo $VERSION
zsh 2.4 beta pl 55
a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi 
yeh
%

  Bourne:

% /bin/sh
$ a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi 
yeh
$ 



Gene
gene@bear.com

--
*******************************************************************************
Bear Stearns is not responsible for any recommendation, solicitation, offer or
agreement or any information about any transaction, customer account or account
activity contained in this communication.
*******************************************************************************



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

* Re: Is this really correct ?
  1996-06-10 17:21 Is this really correct ? gene
@ 1996-06-10 17:42 ` Hrvoje Niksic
  1996-06-10 18:17   ` Zoltan Hidvegi
  0 siblings, 1 reply; 3+ messages in thread
From: Hrvoje Niksic @ 1996-06-10 17:42 UTC (permalink / raw)
  To: ZSH Workers Mailing List, gene

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

-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
* Q: What is an experienced Emacs user?
* A: A person who wishes that the terminal had pedals.



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

* Re: Is this really correct ?
  1996-06-10 17:42 ` Hrvoje Niksic
@ 1996-06-10 18:17   ` Zoltan Hidvegi
  0 siblings, 0 replies; 3+ messages in thread
From: Zoltan Hidvegi @ 1996-06-10 18:17 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zsh-workers, gene

> 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



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

end of thread, other threads:[~1996-06-10 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-10 17:21 Is this really correct ? gene
1996-06-10 17:42 ` Hrvoje Niksic
1996-06-10 18:17   ` Zoltan Hidvegi

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