osx - Why is this bash prompt acting strangely/disappearing, and how do I fix it (OS X)? -


I believe that I use a longer curved Bash Prompt:

  - (Username) - (Wednesday, April 01, 12: 00: 00) - (~ $  

Recently, I have got a bright idea to change it so that the back Based on the value of the exit, if the internal elements of the command, success, () are green, and if failure occurs then it will turn red. The situation of the exit of the tongue will change some more color, but I 'am fine with it), but when typing a command there is more than one line, and due to scrolling the terminal, the prompt disappears! My launch is not good when there is no color, then I guess it is related to me to avoid color, and especially my attachment [, but I can not pin it.

Profile export PS1 = '- (\ e [$ ((32 - $ {?}) Meter \ u \ e [0 min] - (\ e [$ ((32 - $ {})) Meter \ d \ e [0m |? \ E [$ ((32 - $ {}) M \ t \ E [0 m] - (\ e [$ ((32 - $ {?})) M \ w \ e [0 m \ $ ' / Code> 

Thanks in advance!

It looks as if your problem

This works for me * :

  export PS1 = '- (\ [\ e [$ (( 32 - $ {?}) M \] \ u \ [\ e [0m \]) - (\ [[e] [$ (($ - 32)) meter \] \ d \ [\ e [0m] {?} | - | {? ($ - $ {?} [$ (($ 32)) meter \] \ t \ [[E [0m]] - (\ [\ e [$] )) M \] \ w \ [\ e [0m \] \ $ ' 

* Well, actually export PS1 =' \ U @ \ h: \ w \ $ ' my li A works

The quote of the linked post, the answer is to add \ [and \] around all its color sequences in your PS1 announcement:

I have the following values ​​for PS1:

'\ e [0; 34m \ h: \ w [!] \ $ \ E [0m'

Hostname: Working Directory [CommandNumber] $

However, you had the same line-wrapping problem What you had Fixes to include \ [and \] around ANSI so that Shell knows not to include them in the line wrapping calculation. This results in the following values ​​for PS1:

'\ [\ e [0; 34m \] \ h: \ w [!] \ $ \ [\ E [m]]


Comments