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: Greg Wooledge
Subject: Re: For loop with a skip
Date: Sun, 18 Apr 2021 15:29:50 -0400

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]