Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
sh vs zsh behavior
- X-seq: zsh-workers 896
- From: "Timothy J. Luoma" <luomat@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- To: ZSH Users List <zsh-workers@xxxxxxxxxxxxxxx>
- Subject: sh vs zsh behavior
- Date: Tue, 9 Apr 1996 10:38:40 -0400 (EDT)
- Reply-to: luomat@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Compare these two simple scripts (one in sh, one in zsh)
########################################################################
#!/bin/sh
test="one two three"
for i in $test
do
echo this is $i
echo loop
done
exit 0
########################################################################
#!/usr/local/bin/zsh -f
test="one two three"
for i in $test
do
echo this is $i
echo loop
done
exit 0
########################################################################
########################################################################
THE /bin/sh SCRIPT PRODUCES THE OUTPUT:
this is one
loop
this is two
loop
this is three
loop
THE zsh SCRIPT PRODUCES THE OUTPUT:
this is one two three
loop
I want to have 'zsh' behave like 'sh' in this matter. Is there a way to
do this?
What I am specifically trying to do is check to see if some variable is
equal to any type part of a list of possibilities.
I can do this easily in CSH (*shudder*) via:
if ( "$variable" == "one" || "$variable" == "two" || "$variable" == "three
) then
# that should all be one line above
echo "Match"
else
echo "No Match"
endif
How can I do multiple comparisons in ZSH?
Thanks
TjL
ps -- I'm using 2.6-beta13 under NeXTStep/m68k
Messages sorted by:
Reverse Date,
Date,
Thread,
Author