zsh-users
 help / color / mirror / code / Atom feed
From: sac <sac_urs@yahoo.co.in>
To: Zsh users list <zsh-users@sunsite.dk>
Subject: The amazing array feature in zsh
Date: Tue, 15 Aug 2006 21:48:42 -0700 (PDT)	[thread overview]
Message-ID: <20060816044842.44532.qmail@web8403.mail.in.yahoo.com> (raw)

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 


             reply	other threads:[~2006-08-16  4:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-16  4:48 sac [this message]
2006-08-16  6:10 ` John Reese
2006-08-16  7:12 ` Bart Schaefer
2006-08-16 10:07   ` sac

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=20060816044842.44532.qmail@web8403.mail.in.yahoo.com \
    --to=sac_urs@yahoo.co.in \
    --cc=zsh-users@sunsite.dk \
    /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).