To take two variables from a file and act as an input for the script

Hi,

I have done the scripting such that it will read input line by line from a txt file and is passed through a script, but now my requirement is to pass two variables into a script from a file, how could I do this or is there any other better idea ?

for reading singe input from a file, line by line I have used the below script

while read -r inputname
do
  java weblogic.Admin -adminurl  -username weblogic -password xxxxx  -mbean Name=$inputname,ServerRuntime=aaaa,Type=JDBCConnectionPoolRuntime" > output.log
done < filename.txt

Now the requirement is since there needs to be another server also which needs to be monitored, I need to pass as a dynamic value for ServerRuntime

any input is much appreciated!!thanks in advance

What does the content of filename.txt look like? Where do you expect to get this dynamic value, from the file?

Hi Corona

The content of the filename.txt is customizable

I am planning to use two columns, if there is any other better way , i am happy to use it

Name      ServerRuntime
abc       aaaaa
xyz        bbbbb

Right, i am planning to get this dynamic value also for "ServerRuntime" from file along with "Name"

Easily done then.

while read -r var1 var2
do
....
done < inputfile
1 Like

great, will check and update you
Thanks much again for your quick response

---------- Post updated 12-11-12 at 09:09 AM ---------- Previous update was 12-10-12 at 03:45 PM ----------

cool, worked as a charm and thanks again to you Corona!