Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input file names..

Status
Not open for further replies.
Joined
Oct 22, 2001
Messages
215
Location
US
I know there is an easy way to do this but probably I am not thinking... I want to get all the filenames as my input of a shell script. I am using 'ls' that displays the names of file. Now I want to take these names as input variable.
ls
a b c

output:
your files are: a , b , c

TIA
 
Try something like:

ls > filesnames

for name in `cat filenames`
do
your actions using the $name variable from filenames
done

Does this help?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top