Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbfsb!cbnewsb.cb.att.com!pfinkel From: pfinkel@cbnewsb.cb.att.com (paul.d.finkel) Newsgroups: comp.unix.shell Subject: Re: for loops Keywords: sh: for i to $FILES Message-ID: <1991Apr9.191145.19402@cbfsb.att.com> Date: 9 Apr 91 19:11:45 GMT References: <3693@ux.acs.umn.edu> <1991Apr9.185256.18650@cbfsb.att.com> Sender: news@cbfsb.att.com Distribution: na Organization: AT&T Bell Laboratories Lines: 25 In article <1991Apr9.185256.18650@cbfsb.att.com> pfinkel@cbnewsb.cb.att.com (paul.d.finkel) 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? >> >>Thanks! >> --eric >Sure! > > count=0 > while $count -lt $files > do > : > count=`expr $count + 1` > done >I think this will do it! Escuse mio, per favor. You need brackets around your test statetment: while [ $count -lt $files ] -- Family motto: Semper ubi, sub ubi. mail: attmail!pfinkel "My name is Fink, whaddaya think, I press pants for nothing?" (Punch line to corny joke that my father always told!)