Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Re: repeat count?
- X-seq: zsh-users 28661
- From: zeurkous@xxxxxxxxxxxxxxx
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Cc: dominik.vogt@xxxxxx, Zsh Users <zsh-users@xxxxxxx>
- Subject: RE: Re: repeat count?
- Date: Thu, 19 Jan 2023 14:50:22 +0000 (UTC)
- Archived-at: <https://zsh.org/users/28661>
- In-reply-to: <CAN=4vMowP0vszuFnzXcxasnirJeXsDt5sc5p-A9wRGjU1SvoZg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <Y8WR4X/amuVc25nF@localhost> <thinkcrap!zeurkous!1673893575.30673@uucp> <CAN=4vMowP0vszuFnzXcxasnirJeXsDt5sc5p-A9wRGjU1SvoZg@mail.gmail.com>
On Mon, 16 Jan 2023 19:49:39 +0100, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> On Mon, Jan 16, 2023 at 7:31 PM <zeurkous@xxxxxxxxxxxxxxx> wrote:
>>
>> On Mon, 16 Jan 2023 19:05:21 +0100, Dominik Vogt <dominik.vogt@xxxxxx> wrote:
>> > 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
>> >
>>
>> Dunno, but one alternative is--
>>
>> for a in {0..9}; do
>> echo "pass number ${a}";
>> done;
>
> Be aware that this is a lot slower if you are iterating many times and
> care about the performance of the loop.
Yes, due to the text processing involved. But in a crunch, it can do.
--zeurkous.
> Roman.
--
Friggin' Machines!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author