Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
leading zeros in for/foreach loops
- X-seq: zsh-users 21293
- From: Andy Spiegl <zsh.Andy@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: leading zeros in for/foreach loops
- Date: Mon, 15 Feb 2016 19:07:19 +0100
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
% for i in {01..03}; echo $i
01
02
03
% foreach i ( {01..03} ); echo $i; end
01
02
03
But these two commands don't give me leading zeros if I FIRST run this:
% for ((i=1;i<=3;i++)) echo $i
1
2
3
Can someone please explain this to me? Does this for loop do
something strange with the variable "i"? How can I avoid that?
Thanks so much!
Andy
--
Our scientific power has outrun our spiritual power.
We have guided missiles and misguided men.
(Martin Luther King Jr.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author