Search code examples
linuxbashperlsshzfs

Why no output from qx(ssh ...)?


If I in Bash do

a=$(ssh 10.10.10.46 ifconfig)

then I see the output in $a, but if I in Perl do

my @a = qx(ssh 10.10.10.46 ifconfig);
print Dumper @a;

then I don't get the output. I have ssh keys, so no login required.

For now would I just like to get simple output, but later I want to pipe from the remote host to the local host all in bash. Will be used for ZFS replication.

Question

Why don't I see the output in Perl?


Solution

  • I was missing the last print. Thanks for the debug tips. Very useful!

    sub rrr {
       my $a = qx(ssh 10.10.10.46 ifconfig);
       return $a;
    }
    
    print rrr();