Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by salva (Abbot)
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

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
Node Status?
node history
Node Type: note [id://1026733]
help
Chatterbox?
[stevieb]: shmem It's something I desired to have years ago, which is why I took over berrybrew. Cross-platform build/test automation locally, or over the network Test::BrewBuild
[shmem]: sounds good.
[shmem]: but I'm crumbling smaller stones. remember...
[stevieb]: I'm working on it to fatten it up and make it more reliant so I can finalize my Raspberry Pi automated build system for that software :) It's all well and fun, until I try to make it work with Windows lol
[shmem]: "debugging a program is more difficult than to write it in the first place. If you code your program as smart as you are, you are, by definition, too dumb to debug it."
[stevieb]: I literally laughed. That's good :) Perhaps I just need to go climb another mountain and forget about it

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2017-03-28 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (342 votes). Check out past polls.