in reply to ssh using expect
My suggestion: use Net::SSH::Expect, it has an example for interactive commands right there in documentation Synopsis.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: ssh using expect
by bala_999 (Novice) on Dec 04, 2007 at 18:34 UTC | |
| [reply] [d/l] |
by tirwhan (Abbot) on Dec 04, 2007 at 19:10 UTC | |
One major thing is wrong: no error checking anywhere. Take a look at the Synopsis again, all those "or die" statements are there for a purpose (change them to "or warn" if you want a softer fail). Also, you're mixing calls to $ssh->exec() with $ssh->waitfor, which is wrong. exec reads out the data sent by the server, so by the time waitfor is called it has nothing to ... err... wait for. You should use "send" in conjunction with "waitfor". Again, RTFM All dogma is stupid. | [reply] [d/l] [select] |
by Anonymous Monk on Jan 12, 2012 at 15:05 UTC | |
but when i run it from perl i get the following: My code is as follows:
| [reply] [d/l] [select] |