freebsd-questions Digest, Vol 340, Issue 15
Chip Camden
sterling at camdensoftware.com
Sun Dec 12 19:11:16 UTC 2010
Quoth Derrick Ryalls on Sunday, 12 December 2010:
> 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....
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
How about a direct approach:
i=0;j=1
while true;do
echo Welcome $i times
i=`expr $i + $j`;if [ $j -eq 1 ];then;j=3;else;j=1;fi
done
Might want to pipe that to more or less.
--
Sterling (Chip) Camden | sterling at camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com | http://chipsquips.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20101212/a124cc13/attachment.pgp
More information about the freebsd-questions
mailing list