Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
The amazing array feature in zsh
- X-seq: zsh-users 10611
- From: sac <sac_urs@xxxxxxxxxxx>
- To: Zsh users list <zsh-users@xxxxxxxxxx>
- Subject: The amazing array feature in zsh
- Date: Tue, 15 Aug 2006 21:48:42 -0700 (PDT)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Sv90Briahh9fLqO+BBsUmXhXIwZccSvwaY3zQMrPseueF6P6pTO1faJVgSi5xJNecxKI9MsDwT4xAGHK5O3+DJhFBY8rwC80zhcKY9zGCxd0EWXwf2fkFlADdJk1Ew5FB8LL5ZEl0KuqXIuNrCMKgKpzl2FzGSYUeXSvsoAHrr0= ;
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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