Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash stdout followed by prompt on same line

Tags:

bash

In bash, some commands put their stdout BEFORE the command prompt and on the SAME line. For example:

$ printf message
message$ 
$ gettext -d gtk20 File
Fichier$ 

I want the stdout on a dedicated line with the command prompt on the NEXT line. I could precede with 'echo' and wrap in back ticks like this, but I wonder if there is a better way (an arg that can be always/often used, etc):

$ echo `printf message`
message
$
$ echo `gettext -d gtk20 File`
Fichier
$ 
like image 415
user389850 Avatar asked Dec 31 '25 22:12

user389850


1 Answers

Try adding a ; printf "\n" or ; echo after your command. The issue is that your output does not end with a newline.

You could also just inject the command output into a single printf "%s\n" command.

like image 178
Borealid Avatar answered Jan 04 '26 14:01

Borealid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!