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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute lines from a file

Status
Not open for further replies.

moonhead

Technical User
Apr 24, 2002
11
GB
Dear All
if i had a file that contained a list of commands
example
ls -l
whoami

how can i extract each line and execute it then send the output of the command to a unique file
moonhead
 
don't forget eval and UUOC to actually perform the command(s).

while read line; do
eval $line > $line.output
done < file Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Good point, Bigoldbulldog. My excuse is it's a Friday! Have a good weekend!
 
simply: sh filename
or chmod 755 filename; filename -----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top