stupejohns
Technical User
Hello,
I'm trying to construct a script that rsh to the hosts within the /etc/hosts file and issues a df -k command, it looks like this;
while (true)
do
read ip hostname rest
if [ "$ip" = "" ]; then
break
else
rsh $ip df -k
fi
done< hosts
Trouble is that after the first successful df -k, the loop starts again but passes a null string to the read which then breaks out of the loop. The hosts file has many more lines that need to be processed and there are no blank lines within the file.
when I substitute rsh $ip df -k with just an echo $ip $hostname the whole input file is processed, so could this be a problem with rsh ?????
Any help with this would be great!
Thanks
stupejohns
I'm trying to construct a script that rsh to the hosts within the /etc/hosts file and issues a df -k command, it looks like this;
while (true)
do
read ip hostname rest
if [ "$ip" = "" ]; then
break
else
rsh $ip df -k
fi
done< hosts
Trouble is that after the first successful df -k, the loop starts again but passes a null string to the read which then breaks out of the loop. The hosts file has many more lines that need to be processed and there are no blank lines within the file.
when I substitute rsh $ip df -k with just an echo $ip $hostname the whole input file is processed, so could this be a problem with rsh ?????
Any help with this would be great!
Thanks
stupejohns