Re: bash and perl output of 'hello' with no \n doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Mike A. Harris wrote:

On Fri, 15 Nov 2002, Marc Murphy wrote:

Has anyone else encountered this problem with a fresh install?

#!/usr/bin/perl
print 'hello';

Does not print, but if I redirect the output to a file using, it does. It also will print if I use the \n character. When I use csh the newline character is not needed. Can anyone tell me what is going on?

This isn't a bug. You're not generating a final '\n' character, and as such, when the program exits, and bash goes to display the prompt, it overwrites the 'hello' thus showing nothing.

You should ensure that any buffers are flushed properly before your program exits.

I noticed that the default PS1 in bash works fine.
So Marc changed PS1 and did it wrong. The problem isn't really the script or bash.
Still, the NL should be there, but it's not required.

Marc, if you want to insure that PS1 (the normal prompt) starts at the beginning of the line,
use a LF (newline, \n), not CR (carrige return, \r).

-Thomas




--
Psyche-list mailing list
Psyche-list@redhat.com
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux