SCO 5.0.5 (i686-pc-sco3.2v5.0.5), scp and the -n option
Damien Miller
djm at mindrot.org
Wed Feb 7 13:02:49 EST 2001
On Tue, 6 Feb 2001, Aran Cox wrote:
> Ok, I went out and answered my own question. If you write a script like
> this:
>
> while read host; do
> [rs]sh $host ls -ld .
> done
>
> And pass a list of hosts via stdin, only the first host gets
> [rs]sh run on it. Then the script just exits. [rs]sh sucks up
> the rest of stdin, unless you prevent it from doing so with the
> -n option.
>
> I don't quite understand why ssh or rsh would read stdin until
> it's empty without the executed program on the other end
> requesting anything of stdin.
There is no way for ssh to know whether the remote program needs data
other than to actually send it.
To get the behaviour you want do:
while read host; do
ssh $host ls -ld . < /dev/null
done
-d
--
| ``We've all heard that a million monkeys banging on | Damien Miller -
| a million typewriters will eventually reproduce the | <djm at mindrot.org>
| works of Shakespeare. Now, thanks to the Internet, /
| we know this is not true.'' - Robert Wilensky UCB / http://www.mindrot.org
More information about the openssh-unix-dev
mailing list