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.
我是 perl 的新手。我想在终端上运行一个 perl 脚本,该脚本接受另一台服务器的 ip 地址,登录(使用用户名和密码),执行 bash 命令并返回结果。任何指导将不胜感激。例如。可能有帮助的类似代码、问题、perl 函数等等。
#!/usr/bin/perl -w use strict; use Net::SSH qw(ssh); my $host = "server1.domain.com"; my $user = "user1"; my $remotedir = "/home/user1/"; my $cmd = "/bin/ls"; ssh("$user\@$host", $cmd);