I'm guessing the $cmd can also be some function ??? The commands are the rest of the perl script...which I could lump as a single function. | [reply] |
| [reply] [d/l] |
Yes...that is exactly what I would like to achieve.
| [reply] |
open(my $pipe, "plink /usr/bin/perl </some/local/script.pl |")
or die "unable to run command: $!";
while (<$pipe>) {
print "response: $_";
}
| [reply] [d/l] [select] |
I use ActivePerl+Net::SSH2 on WinXP to execute perlscript to remote hosts.
1. Connect to remote host $ssh->open();
2. Open channel, start shell, $chan = $ssh->channel();
3. Issue commands through the channel.. $chan->shell();
when I issue shell commands ie. "who" to the Linux machine, the data comes back through the channel. <$chan>
I am using the linux machine as a jumpbox to further SSH to some cisco IOS switches. (firewall restriction)
The problem I encounter is, when I issue "ssh -l username 10.1.1.1", nothing comes back through the channel. My script waits for a "Password:" which never reaches the channel.
Any suggestions?
PS. Same script works fine when issuing Cisco commands to directly SSH connected cisco switches.
| [reply] |