Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ut-emx!perv.pe.utexas.edu!pefv700 From: pefv700@perv.pe.utexas.edu Newsgroups: comp.unix.shell Subject: Re: for loops Message-ID: <46661@ut-emx.uucp> Date: 4 Apr 91 04:36:20 GMT Sender: news@ut-emx.uucp Organization: Dept. of Petroleum Engineering, The University of Texas at Aust Lines: 26 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 How about either while [ $FILES -gt 0 ] do # body FILES=`expr $FILES - 1` done or i=0 while [ $i -lt $FILES ] do # body i=`expr $i + 1` done Chris