1 at a time?

Leslie Mikesell les at chinet.chi.il.us
Mon May 20 06:23:48 AEST 1991


In article <7957 at uklirb.informatik.uni-kl.de> robby at nuchat.sccsi.com (Robert Oliver Jr.) writes:

>  Is there a simple way of putting a listing of files at the command line one
>at a time? Not the hole file listing just the first one. When the program go to 
>the second and so forth it dose not tag on all the other files.  

Which files?  What command line?
If you want to run a program for each file in the current directory:

for i in *
do
  command $i
done

The * is a wild-card directory meta-character that is expanded by the shell
into the list of matching filenames.  The the "for" loop traverses the
list, setting the variable "i" to the next item on each pass through the
loop.

Les mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.shell mailing list