Bourne Shell (/bin/sh) counting?

Jonathan I. Kamens jik at athena.mit.edu
Thu Mar 22 00:42:38 AEST 1990


  In all this talk about the various ways to count in a shell script,
I'm surprised that no one has mentioned the "jot" program, which I
believes comes standard with BSD nowadays (at least with BSD 4.3 and up
-- I don't know about 4.2).  The first paragraph of the description in
the man page says:

     Jot is used to print out increasing, decreasing, random, or
     redundant data, usually numbers, one per line.

If I wanted a loop to execute 10 times, I would just do "for  i in `jot
10`; do" (or whatever the correct syntax is -- I use csh primarily, so I
don't claim to know the sh syntax off the top of my head :-).

  Alas, it isn't freely redistributable, or at least I assume it isn't,
because it isn't in the bsd-sources archives on uunet.uu.net.

  Somebody could probably rewrite it in perl pretty easily :-)  Hell, it
would even be easy to rewrite from scratch in C.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list