First off..thanks to any who try to help me. :) I do appreciate it.
The goal: To go out and query our 'lightwaves' (I am a UNIX admin, and lightwaves are stripped-down linux boxes connected to the serial ports of our servers, to give us a remote console)for server/port information. Hard to believe, as of now, we don't have records and we work in a VERY LARGE ENVIRONMENT.
The tools: Hopefully, Perl's Expect.pm.
The drawback: I do not know Expect; I have chosen Perl's Expect module because I am adequate in Perl (although by no means and expert) and am learning more.
The problem: The documentation I've read is like mud to me, which , I guess, is because I don't know Expect and have never played around with pty's, etc.
I can spawn a ssh process, and issue commands to it, but I'm stuck on figuring out how to capture the output.
My ask is two-fold: 1) Does anyone know of a good source to read about using Expect.pm?
2) Given the code snippet below, can anyone guide me on how to capture the output of the 'listdev' command I issued on the lightwave? (plycon1 ). That is the part where I'm running into trouble.
Thank you!($ssh = Expect->spawn("ssh -l sysadmin $server")) || die "couldn't sp +awn ssh: $!"; unless ($ssh->expect(10,"password")) { die "never got username prompt on $server, " .ssh->exp_error() +,"\n"; } print $ssh "$password\r"; unless ($ssh->expect(10,"sysadmin>")) { die "never got sysadmin prompt on $server, " .ssh ->exp_error( +),"\n"; } print $ssh "listdev\r";
In reply to Expect.pm question by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |