Re: [nsp] Using RSH

From: Niels Bakker (niels=cisco-nsp@bakker.net)
Date: Sat Mar 16 2002 - 12:53:36 EST


>> On Sat, Mar 16, 2002 at 01:05:56AM -0600, Brian wrote:
>>> Is there a way I can "answer" this and let the router know "yes"?
>>> I know that with SNMP or telnet scripting this is easier, but surely
>>> there exists a way via RSH to just send the router a postive or
>>> negative response to a y/n question.

> On Sat, 16 Mar 2002, Gert Doering wrote:
>> Try "echo yes | rsh ..."

* signal@shreve.net (Brian) [Sat 16 Mar 2002, 18:30 CET]:
> That doesn't appear to work. I even tried using like "echo -e yes \r\n"
> (and other combinations thereof). It hangs at the confirm prompt, I have
> to suspend the process then kill it off.

rsh reads from its tty, not from stdin. You can work around this by
using a program called `pty'; it opens a pseudo tty and runs the program
given on its command line on it. The source comes with Stevens' book
_Advanced Programming in the Unix Environment_. Unfortunately I don't
have my modified rsh anymore that worked on Solaris, as the stock rsh on
at least 2.6 had some quirks that prevented it from functioning.

Disclaimer: the above is all from memory, and it's been a while since
I last had to do this. The major problem I had to solve was rsh not
wanting to run without a pty (i.e., from cron).

Good luck,

        -- Niels.



This archive was generated by hypermail 2b29 : Sun Aug 04 2002 - 04:13:08 EDT