in reply to Re^2: Net::SSH2 Interactive command example
in thread Net::SSH2 Interactive command example

Hello everyone I have been trying to use this kind of scripts to connect to a remote machine and execute some commands. I think the connection is well done, but the execution of commands is not working for me. This particular case is about: 1.- I connect via ssh to a linux machine 2.- I enter in a special mode with MML commands (machine to man language) typing 'mml' 3.- I do staff with this mml commands My script is failing in step 2. I just want to send this "mml" and it's not working :( :(
if( $ssh2->connect($host) ) { if( $ssh2->auth_password($user,$pass) ) { print "connected.....\n"; #shell use my $chan = $ssh2->channel(); $chan->blocking(0); $chan->shell(); print "sending command....\n"; my $num = 10; while($num--){ sleep(1); } print $chan "mml\n"; select(undef,undef,undef,0.2); print $buf while ($len = $chan>read($buf,512)) > 0;
I tried with several methods: print $chan, exec ('comand'), everything in this thread... but still not working. Any idea?