From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: printing arrays and index
Date: Sat, 23 Jul 2005 04:59:15 +0000 [thread overview]
Message-ID: <1050723045916.ZM10289@candle.brasslantern.com> (raw)
In-Reply-To: <gcd2e1pr6d3s08cad77b1f6j3j11d2dgpd@4ax.com>
On Jul 22, 7:08pm, zzapper wrote:
} Subject: printing arrays and index
}
} I'm using
}
} print -C 1 $filessubject
I was sort of puzzled by why that was suggested. "print -l" (that's a
lowercase L, not a one) has the same effect, and works in a lot more
versions of zsh (the -C option is a very recent addition).
} I know want to precede each array entry with it's index number 1,2,3, etc
}
} how do?
The most obvious way is:
print -l $filessubject | cat -n
But something like this works too:
i=0 eval print -l '$((++i))\ '${(q)^filessubject}
If you use 'setopt ksharrays' then change that to $((i++)).
next prev parent reply other threads:[~2005-07-23 4:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-22 18:08 zzapper
2005-07-23 4:59 ` Bart Schaefer [this message]
2005-07-24 6:46 ` zzapper
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=1050723045916.ZM10289@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--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).