zsh-workers
 help / color / mirror / code / Atom feed
From: "Timothy J. Luoma" <luomat@cedman.remote.Princeton.EDU>
To: ZSH Users List <zsh-workers@math.gatech.edu>
Subject: sh vs zsh behavior
Date: Tue, 9 Apr 1996 10:38:40 -0400 (EDT)	[thread overview]
Message-ID: <Pine.NXT.3.92.960409103510.11311F-100000@capitalist.princeton.edu> (raw)


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





             reply	other threads:[~1996-04-09 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-09 14:38 Timothy J. Luoma [this message]
     [not found] <316A7A6F.41C6@uoknor.edu>
1996-04-09 15:01 ` Timothy J. Luoma
1996-04-09 16:55   ` Zoltan Hidvegi
1996-04-09 17:04     ` Timothy J. Luoma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.NXT.3.92.960409103510.11311F-100000@capitalist.princeton.edu \
    --to=luomat@cedman.remote.princeton.edu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).