PS1 line-wrapping with colours problem

后端 未结 3 731
天涯浪人
天涯浪人 2020-12-13 12:56

Here\'s my PS1 variable:

PS1=\'\\u:\\W$(__git_ps1 \"\\e[32m\\][%s]\\e[0m\\]\")$ \'

Works great for picking up my Git branch, but it has the

3条回答
  •  悲哀的现实
    2020-12-13 13:29

    Got it, needed to escape the colours properly.

    Fix:

    PS1='\u:\W$(__git_ps1 "\[\e[32m\][%s]\[\e[0m\]")$ '
    

提交回复
热议问题