Insert new line to bash prompts

2020-02-13 08:28发布

问题:

This seems like a common question, but I can't find this anywhere on Google nor SO. Please point me to the article if you find one.

How do I insert a new line in bash prompts (when you just press ENTER), similar to that in Windows prompt?

Linux:

$
$
$

Windows:

C:\>

C:\>

C:\>

I need that extra space in between.

回答1:

Change the PS1 Bash prompt variable:

PS1="\n$PS1"