Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by salva (Canon)
on Apr 02, 2013 at 16:28 UTC ( [id://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;

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1026733]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-03-28 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found