Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我在 Bash 做
a=$(ssh 10.10.10.46 ifconfig)
然后我在 中看到输出$a,但是如果我在 Perl中看到
$a
my @a = qx(ssh 10.10.10.46 ifconfig); print Dumper @a;
然后我没有得到输出。我有 ssh 密钥,所以不需要登录。
现在我只想得到简单的输出,但后来我想用 bash 从远程主机到本地主机。将用于 ZFS 复制。
问题
为什么我在 Perl 中看不到输出?
open(F,'ssh 10.10.10.46 ifconfig |'); my @a=<F>; close(F); print Dumper(@a);
我错过了最后一个print. 感谢您的调试提示。很有用!
print
sub rrr { my $a = qx(ssh 10.10.10.46 ifconfig); return $a; } print rrr();