for loops

David W. Tamkin dattier at vpnet.chi.il.us
Fri Apr 5 14:17:09 AEST 1991


miquels at maestro.htsa.aha.nl (Miquel van Smoorenburg) wrote in
<2816 at maestro.htsa.aha.nl>:

| POSIX states that sh(1) should be able to evaluate expressions, 
| so you can do something like
| while [ $FILES != 0 ]
| do
| 	echo -n '* '
| 	FILES=$[$FILES - 1]
| done

| But I haven't seen a sh anywhere that is already capable of doing this
| (not even the one I am writing myself for Minix... yet.).
| Maybe somebody knows if a new ksh can do this?

Even an old ksh can do 
let FILES = $FILES - 1
or
(( FILES = FILES - 1 ))

David Tamkin  PO Box 7002  Des Plaines IL  60018-7002  dattier at vpnet.chi.il.us
GEnie:D.W.TAMKIN  CIS:73720,1570  MCIMail:426-1818  708 518 6769  312 693 0591



More information about the Comp.unix.shell mailing list