Mar 13, 2012, 12:43 PM
Post #1 of 3
Capturing STDOUT from ssh command
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)
my $result= print `ssh $filername $command`;
my $expectedresult= "######";
if ($result eq $expectedresult)
print "Test PASS: $result";
print "Test FAIL Expected: $expectedresult Result: $result";
any help here? thanks!
(This post was edited by carmen.arizona on Mar 13, 2012, 12:45 PM)