Re: How to get ssh to work in a loop
From: Kevin Rodgers (ihs_4664_at_yahoo.com)
Date: 12/02/03
- Next message: Kevin Rodgers: "Re: Shell does not return control"
- Previous message: Maurizio: "Re: Convert text in UTF-8"
- In reply to: Mike Cross: "Re: How to get ssh to work in a loop"
- Next in thread: Peter Jones: "Re: How to get ssh to work in a loop"
- Reply: Peter Jones: "Re: How to get ssh to work in a loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 02 Dec 2003 09:36:15 -0700
[Please don't top-post.]
Mike Cross wrote:
> The for loop scrambles stdin, which upset, ssh/rsh, I get around ths by
> using while loop:
>
>
> while read line
> do
> ..
> ..
> rsh $line date
> ..
> done < file
>
> works OK
No, it doesn't. The body of the while ... done loop inherits its file
descriptors, and the rsh command still consumes all of the remaining
data in standard input. The way to get around this problem is to
redirect rsh's standard input
rsh $host ... < /dev/null
or use the command line option provided for this purpose
rsh -n $host ...
-- Kevin Rodgers
- Next message: Kevin Rodgers: "Re: Shell does not return control"
- Previous message: Maurizio: "Re: Convert text in UTF-8"
- In reply to: Mike Cross: "Re: How to get ssh to work in a loop"
- Next in thread: Peter Jones: "Re: How to get ssh to work in a loop"
- Reply: Peter Jones: "Re: How to get ssh to work in a loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|