Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: repeat count?
- X-seq: zsh-users 28641
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: repeat count?
- Date: Mon, 16 Jan 2023 19:04:07 +0000
- Archived-at: <https://zsh.org/users/28641>
- In-reply-to: <Y8WR4X/amuVc25nF@localhost>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxx>
- References: <Y8WR4X/amuVc25nF@localhost>
2023-01-16 19:05:21 +0100, Dominik Vogt:
> Is it possible to get the pass number of a repeat loop from within
> the loop, or is it necessary to use a hand written counter?
>
> repeat 10; do
> echo "pass number ???"
> done
[...]
You can always do:
n=0; repeat 10 echo pass number $((++n))
Or a la ksh93
for ((n=1;n<=10;n++)) echo pass number $((++n))
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author