# freebsd-questions Digest, Vol 340, Issue 15

Mark Terribile materribile at yahoo.com
Sun Dec 12 19:26:44 UTC 2010

```Okay, per private correspondence, here's one that works for the rule (insert your
own upper limit):

(( s = -3, d = -1 )) ; while (( i = ( s += 2 + ( d = -d ) ),  i <= 12 )) ; do
echo "Welcome \$i times"
done

Yeah, this needs an explanation in the comments, and it might be tricky to
extend to other sequences.  But I think I could do it for most reasonable ones.

--- On Sun, 12/12/10, Derrick Ryalls <ryallsd at gmail.com> wrote:

From: Derrick Ryalls <ryallsd at gmail.com>
Subject: Re: freebsd-questions Digest, Vol 340, Issue 15
To: "Mark Terribile" <materribile at yahoo.com>
Cc: "S Mathias" <smathias1972 at yahoo.com>, freebsd-questions at freebsd.org
Date: Sunday, December 12, 2010, 1:22 PM

On Sun, Dec 12, 2010 at 9:45 AM, Mark Terribile <materribile at yahoo.com> wrote:

>

> It's ok, that i can use this, when i want an incrementing

> sequence, in a given way:

>

> # {START..END..INCREMENT}

> \$ for i in {0..10..2}; do echo "Welcome \$i times"; done

> Welcome 0 times

> Welcome 2 times

> Welcome 4 times

> Welcome 6 times

> Welcome 8 times

> Welcome 10 times

> \$

>

> but what's the "magic" for this? :

>

> \$ MAGIC; do echo "Welcome \$i times"; done

> Welcome 0 times

> Welcome 1 times

> Welcome 4 times

> Welcome 5 times

> Welcome 8 times

> Welcome 9 times

> \$

What's wrong with

for i in 0 1 4 5 8 9 ; do echo "Welcome \$i times"; done

?

Or is there some rule that you want followed?  If there is, it's not

obvious to me.  (Sorry.)

Mark Terribile

+1, +3, +1, +3....

```