Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Is this really correct ?



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

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




Messages sorted by: Reverse Date, Date, Thread, Author