Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: repeat count?



On Mon, Jan 16, 2023 at 07:49:39PM +0100, Roman Perepelitsa wrote:
> >  for a in {0..9}; do
> >   echo "pass number ${a}";
> >  done;

print -f 'pass number %d\n' {0..9}

# is there a way to online this ?
set -- {0..9}
print -l 'pass number '$^@

n=0; repeat 10 echo pass number $[++n]

> Be aware that this is a lot slower if you are iterating many times and
> care about the performance of the loop.

my prefered would be

seq -f 'pass number %g' 10

regards,
marc




Messages sorted by: Reverse Date, Date, Thread, Author