当我连接到 proFTP 服务器时,我会收到打印到标准输出的欢迎消息。
my $sftp = Net::SFTP::Foreign->new($sftserver);
一切正常,但我怎样才能摆脱这个消息?
我不想将整个脚本输出通过管道传输到/dev/null 并且我无权访问服务器的配置。
谢谢。
最佳答案
使用文档中的stderr_fh
选项:
stderr_fh => $fh
redirects the output sent to stderr by the SSH subprocess to the given file handle.
It can be used to suppress banners:
open my $ssherr, '>', '/dev/null' or die "unable to open /dev/null"; my $sftp = Net::SFTP::Foreign->new($host, stderr_fh => $ssherr);
关于Perl 使用 Net::SFTP::Foreign 摆脱服务器欢迎消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50101490/