zsh-users
 help / color / mirror / code / Atom feed
* The amazing array feature in zsh
@ 2006-08-16  4:48 sac
  2006-08-16  6:10 ` John Reese
  2006-08-16  7:12 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: sac @ 2006-08-16  4:48 UTC (permalink / raw)
  To: Zsh users list

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 


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

end of thread, other threads:[~2006-08-16 10:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-16  4:48 The amazing array feature in zsh sac
2006-08-16  6:10 ` John Reese
2006-08-16  7:12 ` Bart Schaefer
2006-08-16 10:07   ` sac

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