zsh-workers
 help / color / mirror / code / Atom feed
* sh vs zsh behavior
@ 1996-04-09 14:38 Timothy J. Luoma
  0 siblings, 0 replies; 4+ messages in thread
From: Timothy J. Luoma @ 1996-04-09 14:38 UTC (permalink / raw)
  To: ZSH Users List


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





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

end of thread, other threads:[~1996-04-09 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <316A7A6F.41C6@uoknor.edu>
1996-04-09 15:01 ` sh vs zsh behavior Timothy J. Luoma
1996-04-09 16:55   ` Zoltan Hidvegi
1996-04-09 17:04     ` Timothy J. Luoma
1996-04-09 14:38 Timothy J. Luoma

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