Subject: Re: bug#68892: 'tr' function | Outputs printed before the command prompts

From: Davide Brini <[email-masked]>
Date: Fri, 2 Feb 2024 15:57:20 +0100

On Fri, 2 Feb 2024 16:40:26 +0200, Ricky Tigg <[email-masked]> wrote:

> OS: Fedora v86_64. coreutils v.: 9.3. Shell: bash v. 5.2.26.
>
> Hello. Normally outputs are printed after the command prompt; "#" "$" on
> my system.
>
> (...)@(...):~$ rpm -ql coreutils | head -2
> /usr/bin/[
> /usr/bin/arch
>
> Unexpectedly, through a pipe invoking 'tr', outputs are printed before the
> command prompts.
>
> (...)@(...):~$ rpm -ql coreutils | head -2 | tr '\n' ' '
> /usr/bin/[ /usr/bin/arch (...)@(...):~$

You're removing newlines, and this causes the prompt to be displayed
immediately after the command output without an intervening newline.

--
D.