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

The amazing array feature in zsh



The array subject in zsh is too huge and fascinating.
I discovered this amazing feature of array recently,
assigning values just like we do in some high level
language. 
Here is a example,

    files=()			# initialize to null
    for mfile in `svn stat $1 | grep '^M' | awk '{
print $2 }'`
      do
      files+=($mfile)
    done
    print -c $files		# print with tabs

Notice tha assignment to the array variable +=. 

And actually this can be iterated like,
    
    for file in $files
    do
        <do something with $file>
    done

I dont know if any other shell provides similar
feature, but this one is too good and useful, and
makes the use of array in shell very easy. But I dont
think this is documented in zsh, atleast I couldn't
find it.

Regards
sac.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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