Shell Prompt Line Wrapping Issue

前端 未结 9 1942
一生所求
一生所求 2021-01-30 03:30

I\'ve done something to break my Bash Shell Prompt in OS X (10.5.7) Terminal.

This is the PS1 that I had configured:

PS1=\'\\[\\e[1;32m\\]\\h\\[\\e[0m\\]         


        
9条回答
  •  北海茫月
    2021-01-30 04:00

    I am now using this PS1 with good effect:

    green=$(tput setaf 2)
    blue=$(tput setaf 4)
    bold=$(tput bold)
    reset=$(tput sgr0)
    PS1="\[$green$bold\]\h\[$reset\]:\[$blue$bold\]\w\[$reset\]\$ "
    

    Scrolling through my command history appears to handle line wraps now. However in the meantime since this question was asked I have also updated my OS X to 10.6.3

提交回复
热议问题