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

后端 未结 3 1854
[愿得一人]
[愿得一人] 2020-12-05 05:48

I admit that I use a somewhat long-winded bash prompt:

--(username)-(Wed April 01|12:00:00)--(~ $

Recently, I got the bright idea to change

3条回答
  •  一生所求
    2020-12-05 06:05

    You just seem to be missing the start and end brackets around your escapes (before the first '\e' and after the last 'm'):

    PS1='--(\[\e[$((32-${?}))m\u\e[0m)-(\e[$((32-${?}))m\d\e[0m|\e[$((32-${?}))m\T\e[0m)--(\e[$((32-${?}))m\w\e[0m\] \$ '
    

    As mentioned, the PS1 var does not need to be exported: only your shell needs to see it.

提交回复
热议问题