CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Capturing STDOUT from ssh command: Edit Log



carmen.arizona
Novice

Mar 13, 2012, 12:43 PM


Views: 2947
Capturing STDOUT from ssh command

hello,

I'm trying to code a test that uses an intermediate host to connect to a filer. Basically filers run super stripped down bash, so we're using the host so perl can be used.

i connect to the filer with ssh and run the command, which it returns to the host. Its all good getting that information, but it's storing $result=1, instead of the STDOUT. Tried using $STDOUT as a variable and it was blank.
(the expected result is hidden because it contains a private email address)


Code
my $result= print `ssh $filername $command`; 
my $expectedresult= "######";

if ($result eq $expectedresult)
{
print "Test PASS: $result";
}
else
{
print "Test FAIL Expected: $expectedresult Result: $result";
}


any help here? thanks!Pirate


(This post was edited by carmen.arizona on Mar 13, 2012, 12:45 PM)


Edit Log:
Post edited by carmen.arizona (Novice) on Mar 13, 2012, 12:45 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives