[comp.unix.shell] 1 at a time?

robby@nuchat.sccsi.com (Robert Oliver Jr.) (05/15/91)

  Hi there,

  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.  

                                                        Thanks,
                                                        Robert Oliver
                                                        robby@nuchat.sccsi.com

tomb@marque.mu.edu (Tom Baas) (05/19/91)

In article <7957@uklirb.informatik.uni-kl.de> robby@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.  

Do you mean something like:

set `ls`
for i
  do
     your_command_on $1
     shift
  done
.
.

-- 
I can accept e-mail and Voice-mail at:
tbaas!tom      or   tom@tbaas      or  ....marque!tomb  or  tomb@marque
or Voice at: 1-414-377-4038

les@chinet.chi.il.us (Leslie Mikesell) (05/20/91)

In article <7957@uklirb.informatik.uni-kl.de> robby@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@chinet.chi.il.us