perl - ssh命令未运行perl脚本

标签 perl unix ssh

我有以下Perl脚本

#!/usr/bin/perl
$userinput =  <STDIN>;
chomp ($userinput);
while ( $userinput ne "DONE")
{
        print STDOUT "User typed ----->  $userinput\n";
        $userinput =  <STDIN>;
        chomp ($userinput);
}

我已经在Unix盒子上复制了它,在本地可以正常工作,但是当我尝试使用ssh从另一个盒子远程运行此perl脚本时,它不起作用。

我正在使用以下命令运行此脚本。
ssh username@hostname /tmp/testremote.pl

它只是卡在STDIN上,不返回任何东西。

知道为什么这不起作用吗?

最佳答案

尝试在#之后添加 $|=1; !线。

关于perl - ssh命令未运行perl脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4551919/

相关文章:

linux - Perl 一行liner + 匹配IP地址

perl - 如何使用 WWW::Mechanize 检查复选框?

python - grep、awk、bash 和 friend ?有什么工具可以处理这些数据吗?

c - 在父进程恢复执行之前等待所有子进程 UNIX

xml - 如何在 unix 中安装 libxml2

string - Perl,字符串替换

unix - 删除额外的换行符

ant - 从 ant 获得格式良好的输出 - groovy 脚本中的 sshexec

windows - 在 Windows 8 上使用 SSH 连接到 Amazon EC2 的权限被拒绝

c++ - Linux 下 C++ 中的 SSH 连接