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!

question about rsh and read

Status
Not open for further replies.

dell9

Programmer
Apr 17, 2007
1
JP
this shell works,it read each line of the file and output
#!bin/bash

while read line
do
echo $line
done < inputfile
---------------------------
but when i add an rsh command within the loop, shell only reads the first line of the inputfile and stops.
#!bin/bash
while read line
do
echo $line
rsh 10.188.15.24 ls > fff
done < inputfile

anybody know what's wrong with that?and how should i fix it?
thanks
 
Hi,

Is your rsh configured to connect without password to 10.188.15.24 host ?
If no, mybe this is what is stopping your loop waiting for a password to connect.
 
Have a look at the -n option in your rsh man page.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
One way is to run rsh with input redirected from /dev/null to keep it from gobbling up your local input data

while read line
do
rsh wherever whatever [red]</dev/null[/red] >outfile
done <infile

rsh -n also works in the same manner.

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top