Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Dec 2010 11:11:10 -0800
From:      Chip Camden <sterling@camdensoftware.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: freebsd-questions Digest, Vol 340, Issue 15
Message-ID:  <20101212191110.GB97909@libertas.local.camdensoftware.com>
In-Reply-To: <AANLkTi=DwZKv9ZnkzLGL_bJn4LUjkxxoZ81akTRc0A%2BJ@mail.gmail.com>
References:  <20101212120029.9002610657DF@hub.freebsd.org> <709178.44988.qm@web110304.mail.gq1.yahoo.com> <AANLkTi=DwZKv9ZnkzLGL_bJn4LUjkxxoZ81akTRc0A%2BJ@mail.gmail.com>

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

--wq9mPyueHGvFACwf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Quoth Derrick Ryalls on Sunday, 12 December 2010:
> On Sun, Dec 12, 2010 at 9:45 AM, Mark Terribile <materribile@yahoo.com>wr=
ote:
>=20
> > >
> > > 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....
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o=
rg"

How about a direct approach:

i=3D0;j=3D1
while true;do
  echo Welcome $i times
  i=3D`expr $i + $j`;if [ $j -eq 1 ];then;j=3D3;else;j=3D1;fi
done

Might want to pipe that to more or less.

--=20
Sterling (Chip) Camden    | sterling@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com        | http://chipsquips=
.com

--wq9mPyueHGvFACwf
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQEcBAEBAgAGBQJNBR5OAAoJEIpckszW26+R2WAH/2GB+wu8Rxi/BzkhXgKpkfZP
OzrdNtzR0KkiU5b+/JT5E5lTNuCIMymHQ4TdmD0MEBQU8AiE1AraAO5SXkhzdfj3
hKYtR+Kk27uh65rJvcTYU7SnKBVtC+iEqQ9BNLcT7uAHPyl0NIRZ+9byV2xfPFL3
0m/CYrUkrZxW9qkPSc01aEfCIAzweZgGGrHzbRBV+DraS37w0RMapkaRegGHsam2
upmt7uc/fve/zL4Ca6GGX6XHpCfC01r4P8Hw8N1R5s8l/JTGnj2NA/qRpgMhglfy
vqEJoMFvfr1yug0W9kDy7J0RhqiPlqp2whNHwBzE70o3295t3/HgxbU+VarIGig=
=1f14
-----END PGP SIGNATURE-----

--wq9mPyueHGvFACwf--



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