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

READING COMMANDS FROM A FILE 2

Status
Not open for further replies.

PrgrmsAll

Programmer
Apr 8, 2003
180
US
I am very new to HP-UX and hope this is an easy question to answer for someone: I want to place some commands into a file and, from within a job, call the contents of a file to be read line by line as if typed at the prompt?

Thanks in advance.
 
PrgrmsAll,

man read

#!/usr/bin/ksh

while read variable_name;
do
...
done<input_file

John
 
Or really easy (but maybe not as elegant as johngiggs):

fileone.sh contains all the commands you want to run.

filetwo.sh has other commands in it. When you want to run all the commands listed in fileone.sh, just add in filetwo.sh:

/path/to/fileone.sh

and the commands will be executed. (Be sure both files are exeutable.)

But if you do want to become more complex in your scripting, you do need to know how to use read.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top