rjurney
rjurney

Reputation: 5150

How can I wrap each bash command's output in a single blank newline before and after?

How can I wrap bash command output so that it is surrounded on top and bottom with a blank newline?

I have trouble picking out the current command's output from the previous command and the next prompt. I've tried PROMPT_COMMAND=echo but this only adds a newline at the end and not the beginning. How can I have both so I can better parse my bash reality?

For example right now I see this:

rjurney$ ls ~/tmp/
total 312
-rw-r--r--   1 rjurney  staff    472 Mar 27 16:40 README.md
rjurney$

I want to see the following:

rjurney$ ls ~/tmp/

total 312
-rw-r--r--   1 rjurney  staff    472 Mar 27 16:40 README.md

rjurney$

Thanks!

Upvotes: 0

Views: 220

Answers (1)

jhnc
jhnc

Reputation: 16771

Bash 4.4 introduced PS0.

To accomplish a blank line before and after each command, you can set PS0 and PS1 as:

PS0="
"
PS1="
$PS1"

Upvotes: 5

Related Questions