Adds a line break after PS1… here is a solution to the problem.
Adds a line break after PS1
I’m trying to add a newline after the prompt. Basically I want :
$ ls
<-- how do I get this line break?
file1 file2 file3
<-- this one is easy, PS1="\n$ " or whatnot
$
Replace
$ ls
file1 file2 file3
$
Solution
If you’re using Bash, you can provide preexec using a script like this one
Function.
With preexec
, you can add a line break after the prompt by editing the .bash_profile
preexec() { echo; }
preexec_install
Note that I had to modify line 125 of the above linked script to read
it
PROMPT_COMMAND="${PROMPT_COMMAND} preexec_invoke_cmd"
On my OS X machine.