Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Net::SSH::Any does not return output for few specific commands

by salva (Monsignor)
on Apr 02, 2013 at 16:28 UTC ( #1026733=note: print w/ replies, xml ) Need Help??


in reply to Net::SSH::Any does not return output for few specific commands

Add error checks:

$ssh = Net::SSH::Any->new($hostname, user => $username, password => $p +assword); $ssh->error and die "unable to connect to remote host: " . $ssh->error +; $out = $ssh->capture(“who am I”); $ssh->error and die "remote command failed: " . $ssh->error; print $out;


Comment on Re: Net::SSH::Any does not return output for few specific commands
Download Code
Re^2: Net::SSH::Any does not return output for few specific commands
by magic_007 (Initiate) on Apr 02, 2013 at 16:35 UTC

    Thanks Salva for quick reply. I added error check but no break. The code is connecting to the host it did not die and the $ssh->error is printing 0.

      My problem got solved. Instead of "who am i" I used "whoami" and i got the output.

      I even tried "who -am -u" but it did not work but i could not find out why capture doesn't return output for those commands.

      Thanks anyways.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026733]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-07-25 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls