• Re: bash prompt question

    From Tavis Ormandy@taviso@gmail.com to comp.unix.shell on Sun Jul 6 23:58:08 2025
    From Newsgroup: comp.unix.shell

    On 2024-09-19, Fran|oois Patte wrote:
    Bonjour,

    Wanting to personalize my bash prompt I wrote in my .bashrc file (with
    the help of "Learning the BASH shell"):

    export PS1='\[\e[1;35m\]\u@\h -\d- ${text} \W\[\e[m]\]\$ '


    The \[\e[m]\] section seems wrong to me.

    I think this is supposed to be an sgr reset which is \e[0m (although I
    think omitting the 0 is usually okay), but then you include a literal ],
    is that intentional?

    The \[...\] is supposed to indicate unprintable characters, so the shell
    knows where the cursor is.

    Soo...if you did want the ], then I think it should be this:

    \[\e[m\]]

    Tavis.
    --
    _o) $ lynx lock.cmpxchg8b.com
    /\\ _o) _o) $ finger taviso@sdf.org
    _\_V _( ) _( ) @taviso
    --- Synchronet 3.21a-Linux NewsLink 1.2