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

Unable to process a for loop as expected??



Hello there!

I hope I am writing to the proper person(s).  If not just let me know 
who to write to or better yet,  forward this to the proper 
party(ies).

My problem is trying to read in a string of values into a for loop.

A trivial script example is provided:

-------------------------------------------------------------
#!/bin/zsh

list="a b c d"

for character in $list
do
   echo "Character is $character"
done
--------------------------------------------------------------
 
The expected output (Exactly what I wish to accomplish):

Character is a
Character is b
Character is c
Character is d

Actual output (Not what I want to accomplish):

Character is a b c d

A similar script using the /bin/bash shell produces the "expected" output, 
however, using the /bin/zsh shell produces the "actual", i.e., 
unwanted, output

Can some one help me resolve this issue.  I am indeed looking for a 
resolution that will allow me to produce the "expected" ouput in such 
a for loop construct.

BTW, according to the extracted sources, I am using zsh version zsh-2.6-beta19.  
However, according to the man pages, I am using zsh version 2.7.  (Why 
the discrepancy?)

I am running the LINUX operating system, version 1.3.91.

If you need to know more info jusk ask :-).

Thanks for your help!

Dom.




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