Link to home
Start Free TrialLog in
Avatar of a3global
a3global

asked on

Bash Script Help

I have a file called : server.lst
# cat server.lst
server1  hmc1
server2  hmc2
server3  hmc4
server4  hmc4

I am using a script to use this server list and process some information, Here is how my script looks like

#!/bin/bash
server=~/server.lst
while read -r ser hmc;
do
echo " Name of Server : $ser"
ssh hscroot@$hmc "lshwres -r procpool -m $ser"
done < "$server"

The problem is this script is only accepting the first line"server1  hmc1" and giving me the input, Its not going through all the rows in server.lst file

Here is the output i get when I run the above script

$ sudo ./testscript
Name of the server :server1
0 :Defaultpool
1:DB2
2:Websphere

So I dont know why I the script is not reading other line, Can someone help
ASKER CERTIFIED SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of a3global
a3global

ASKER

Awesome cat $server and "ssh -n" did the trick