I have this:
$ any_command
any_command: command not found
But i need this:
$ any_command
any_command: command not found
What add to PS1?
I have this:
$ any_command
any_command: command not found
But i need this:
$ any_command
any_command: command not found
What add to PS1?
You can use trap
command for this with DEBUG
signal:
trap 'echo' DEBUG
This will print a newline before any command output.
$ any_command
bash: any_command: command not found
$
Or:
$ date
Tue Sep 29 17:51:38 EDT 2015
$
The GNU Bash Manual contains a section on prompting. The newline escape is probably what you're looking for. For example:
export PS1='\n$ '
Alternatively, you can simply add an echo before or after your command. For example:
$ echo; echo foo
foo
You can automate the extra echo (or other screen output) with the Bash shell's PROMPT_COMMAND variable. The PROMPT_COMMAND isn't limited to just prompting, but it can certainly be leveraged to do what you want in this case. For example:
# call echo before issuing PS1
export PROMPT_COMMAND='echo'
# print the equals sign 80 times before issuing PS1
export PROMPT_COMMAND="printf '=%.0s' {1..80}"
I wanted a way to do this too - to help visually differentiate the prompt from other command output ( especially when I can't otherwise do so, colour isn't always an option ) - and this is what I came up with:
export PROMPT_COMMAND="echo; trap 'echo; trap - DEBUG' DEBUG"
First echo runs before the prompt, then we set our trap, which does the post prompt newline, and also removes the trap, at least until the next time the prompt command is run.
Too soon to say whether this is a good idea or not! But it works:
root@epyc:~# seq 1 5
1
2
3
4
5
root@epyc:~#