in reply to Set a variable to remote information

First, your "use" is capitalized. That won't work.

A quick look at the docs for Net::SSH suggests you probably need to use sshopen2() or sshopen3() rather than issh().

If this is all you are doing though, you might get by with something much more simple like:

my $dig_output = `ssh $user\@$host $cmd`;

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Set a variable to remote information
by needhelp (Initiate) on Jul 02, 2003 at 16:01 UTC
    Sorry about the "use", that was just a mistype. But anyways, I have tried the:
    my $dig_output = issh("$user\@$host", "$cmd")
    ..and it prints out a zero??? And I would use sshopen2() or sshopen3() but all I need to do is perform the one command. Also, if I use those I will have to setup access keys, which would be quite tedious for my finished program.. By the way, your 2 cents are quite helpful.... And sorry about the chop/chomp, I'm very new to perl, just trying to write something to make my life a little easier.. Thanks
      But anyways, I have tried the:
      my $dig_output = issh("$user\@$host", "$cmd")
      ..and it prints out a zero???

      Uhm... where did you get that from? It wasn't what I suggested... ;-)

      My suggestion was to forego the use of Net::SSH and just use a qx() or backticks instead. Since all you want is the output from the one command, that might prove to be much easier.

      -sauoq
      "My two cents aren't worth a dime.";
      
        Wow... Thanks you soo much. I got what I wanted plus I don't have to (U)se Net::SSH ;) Thanx, John