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!

Shell Script Question 1

Status
Not open for further replies.

barryp

Programmer
Jan 30, 2002
48
GB
Please help a newbie !

I have a shell script which takes 2 parameters
I now need to run this script usiong a control file
e.g.

Control File contains
param1.1 param1.2
param2.1 param2.2
param3.1 param3.2

The shell script would be run 3 times
How can I set up a loop to achieve this?
I have tried

for i in `cat controlfile` but that gives 6 loops

and

while read i j < controlfile but that reopens controlfile each iteration-so loops endlessly

I could structure the controlfile like
param1.1/param1.2
but then how do I split one variable into 2 at the / ??

Ideas vey welcome


what I need is
 
Found my own solution

I can 'cat' into the while
So

cat controlfile | while read param1 param2
do

myscript $param1 $param2

done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top