for loops

Bob Daniel rad at genco.bungi.com
Fri Apr 5 05:20:42 AEST 1991


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?
>

for i in $FILES
do
	ls -l $i
	....  or whatever to do with that file
done


If FILES="/etc/inittab /etc/passwd /etc/mnttab etc...", each file will be 
treated individually in the example above.



More information about the Comp.unix.shell mailing list