Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Dec 2010 11:26:43 -0800 (PST)
From:      Mark Terribile <materribile@yahoo.com>
To:        Derrick Ryalls <ryallsd@gmail.com>
Cc:        S Mathias <smathias1972@yahoo.com>, freebsd-questions@freebsd.org
Subject:   Re: freebsd-questions Digest, Vol 340, Issue 15
Message-ID:  <636022.69287.qm@web110310.mail.gq1.yahoo.com>
In-Reply-To: <AANLkTi=DwZKv9ZnkzLGL_bJn4LUjkxxoZ81akTRc0A%2BJ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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

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

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

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

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



On Sun, Dec 12, 2010 at 9:45 AM, Mark Terribile <materribile@yahoo.com> wro=
te:
=0A>
=0A> It's ok, that i can use this, when i want an incrementing
=0A> sequence, in a given way:
=0A>
=0A> # {START..END..INCREMENT}
=0A> $ for i in {0..10..2}; do echo "Welcome $i times"; done
=0A> Welcome 0 times
=0A> Welcome 2 times
=0A> Welcome 4 times
=0A> Welcome 6 times
=0A> Welcome 8 times
=0A> Welcome 10 times
=0A> $
=0A>
=0A> but what's the "magic" for this? :
=0A>
=0A> $ MAGIC; do echo "Welcome $i times"; done
=0A> Welcome 0 times
=0A> Welcome 1 times
=0A> Welcome 4 times
=0A> Welcome 5 times
=0A> Welcome 8 times
=0A> Welcome 9 times
=0A> $
=0A
=0AWhat's wrong with
=0A
=0Afor i in 0 1 4 5 8 9 ; do echo "Welcome $i times"; done
=0A
=0A =A0?
=0A
=0AOr is there some rule that you want followed? =A0If there is, it's not
=0Aobvious to me. =A0(Sorry.)
=0A
=0A =A0 =A0Mark Terribile
=0A
=0A
+1, +3, +1, +3....
=0A=0A=0A=0A      



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?636022.69287.qm>