打印:不产生输出 [英] Print: producing no output

查看:55
本文介绍了打印:不产生输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑.我刚买了一台新的开发机器,perl 似乎没有为 print 命令输出任何内容.

I'm fairly confused. I just got a new development machine, and perl appears to be outputting nothing for print commands.

#!/usr/bin/perl
use warnings;
use strict;
print "A";
print STDOUT "B";
print STDERR "C";
open FH, ">", "testprint';
print FH "D";
close FH;

在控制台中不产生任何东西,testprint 变成一个 1-bye(空)文件.

Produces nothing in the console, and testprint becomes a 1-bye (empty) file.

即使这样也不会产生任何结果:

Even this produces nothing:

perl -e "print 'a';"

这发生在我机器上的两个 perl 二进制文件中.我不知道从哪里开始调试这个问题.有什么想法吗?

This occurs for both perl binaries that happen to be on my machine. I'm stumped about where to start debugging this problem. Any ideas?

perl -v

This is perl, v5.8.8 built for x86_64-linx-thread-multi

which perl

/usr/bin/perl

推荐答案

问题不是 STDOUT 丢失或从 shell 重定向,而是 shell 被设置为发送没有回车符的回车编写提示时换行,从而覆盖发送到同一行的所有输出.

The problem was not STDOUT missing or redirected from the shell, but rather that the shell was set to send a carriage return without a newline when writing a prompt, thus overwriting all output sent to the same line.

特别是,我的旧版本 zsh 设置了 promptcr.有关详细信息,请参阅此处的问题 3.23.

Specifically, my old version of zsh had promptcr set. See question 3.23 here for more information.

这篇关于打印:不产生输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆