for loops

paul.d.finkel pfinkel at cbnewsb.cb.att.com
Wed Apr 10 05:11:45 AEST 1991


In article <1991Apr9.185256.18650 at cbfsb.att.com> pfinkel at cbnewsb.cb.att.com (paul.d.finkel) writes:
>In article <3693 at ux.acs.umn.edu> edh at 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!)



More information about the Comp.unix.shell mailing list