help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: For loop with a skip


From: pauline-galea
Subject: Re: For loop with a skip
Date: Sun, 18 Apr 2021 21:37:22 +0200

That works as I liked it to be.  Many thanks.




> Sent: Monday, April 19, 2021 at 7:29 AM
> From: "Greg Wooledge" <greg@wooledge.org>
> To: help-bash@gnu.org
> Subject: Re: For loop with a skip
>
> On Sun, Apr 18, 2021 at 09:20:55PM +0200, pauline-galea@gmx.com wrote:
> > Is it possible to code a loop with a skip in bash
>
> "continue" skips the current iteration.
>
> > Could only do this right now, but would like to skip values
> > using a step size stored in a[3].
> >
> >    for ((i=a[0]; i<=a[1]; i++))
> >    do
> >        echo "$i"
> >    done
>
> Change i++ to something like i+=a[3] if you want that.
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]