I'm in the process of customizing my terminal.
Currently, I have the following:
What I want is a newline after the output of every command, like this:
The only way I have been able to accomplish something close to this is by adding a newline at the beginning of my PS1
. This works, but it annoys the hell out of me that the first time I open up a bash prompt, there is a newline above the very first line. Is there any other way to accomplish this?
As you are running from inside a shell script, just add echo after each awk command i.e. in between the commands you want to get separate outputs. echo adds a newline. For example: Append printf " " at the end of each awk action {}. printf " " will print a newline. Show activity on this post.
In many cases, we need to add a new line in a sentence to format our output. In this tutorial, we’ll explore some Linux commands for printing a new line character ( ) in a sentence. 2. Using echo The echo command is one of the most commonly used Linux commands for printing to standard output:
As you are running from inside a shell script, just add echo after each awk command i.e. in between the commands you want to get separate outputs. echo adds a newline. For example: Append printf " " at the end of each awk action {}. printf " " will print a newline.
Using echo The echo command is one of the most commonly used Linux commands for printing to standard output: By default, echo considers as a regular part of the input string. So, to enable the echo command to interpret the new line character, we should use the -e option:
One approach using printf
:
$ printf '%s\n' * $'\n'
or better (for every command):
$ PROMPT_COMMAND="echo"
$ ls
From man bash :
If
PROMPT_COMMAND
is set and has a non-null value, then the value is executed just as if it had been typed on the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With