Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!spool.mu.edu!news.cs.indiana.edu!news.nd.edu!mentor.cc.purdue.edu!sage.cc.purdue.edu!asg From: asg@sage.cc.purdue.edu (Bruce Varney) Newsgroups: comp.unix.shell Subject: Re: for loops Keywords: sh: for i to $FILES Message-ID: <9640@mentor.cc.purdue.edu> Date: 5 Apr 91 04:14:59 GMT References: <3693@ux.acs.umn.edu> <2816@maestro.htsa.aha.nl> Sender: news@mentor.cc.purdue.edu Reply-To: asg@sage.cc.purdue.edu (Bruce Varney) Organization: Purdue University Lines: 23 In article <2816@maestro.htsa.aha.nl> miquels@maestro.htsa.aha.nl (Miquel van Smoorenburg) writes: }In article <3693@ux.acs.umn.edu> edh@ux.acs.umn.edu (Merlinus Ambrosius) writes: }>In sh, I'd like to do something like a BASIC for loop. Say I have $FILES }>set to some number, and I'd like to go through a loop $FILES times. Can }>this be done in sh? } }POSIX states that sh(1) should be able to evaluate expressions, }while [ $FILES != 0 ] }do } echo -n '* ' } FILES=$[$FILES - 1] }done } No, but the new bash (version 1.07) can! ;-) } --------- ### ## Courtesy of Bruce Varney ### # aka -> The Grand Master # asg@sage.cc.purdue.edu ### ##### # PUCC ### # ;-) # # ;'> # ##