linux 输入长命令行时不会自动换行只会回到行首,并且覆盖前面的内容。解决办法。

Customize Code

\e[ Begin color changes
\e[0m Exit color-change mode
0;32m Specify the color mode

The first number in the color code specifies the typeface:

• 0 – Normal
• 1 – Bold (bright)
• 2 – Dim
• 4 – Underlined

The second number indicates the color you want:

• 30 – Black
• 31 – Red
• 32 – Green
• 33 – Brown
• 34 – Blue
• 35 – Purple
• 36 – Cyan
• 37 – Light gray

My Prompt

before: PS1="\e[0;36m\w\e[0m \e[0;31m>\e[0m\e[0;32m>\e[0m\e[0;34m>\e[0m "

出现的问题“linux 输入长命令行时不会自动换行只会回到行首,并且覆盖前面的内容。解决办法。”

解决办法:将\e[0;36m改为\[\e[0;36m\]的格式,以及\e[0m改为\[\e[0m\]的格式

after:PS1="\[\e[0;36m\]\w \[\e[0;31m\]>\[\e[0;32m>\]\[\e[0;34m\]>\[\e[0m\] "

posted @ 2023-11-05 16:58  Coline1  阅读(199)  评论(0编辑  收藏  举报