Shell Prompt Line Wrapping Issue

前端 未结 9 1944
一生所求
一生所求 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 03:59

    'shopt -s checkwinsize' also works for Cygwin wrap problems also

    0 讨论(0)
  • 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

    0 讨论(0)
  • 2021-01-30 04:00

    If you're using the title bar trick "\e]2;titlebar\a", make sure to escape that too: "\[\e]2;titlebar\a\]"

    0 讨论(0)
提交回复
热议问题