Deutsch   English   Français   Italiano  
<md0gsfFer35U2@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: nntp.eternal-september.org!news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Tavis Ormandy <taviso@gmail.com>
Newsgroups: comp.unix.shell
Subject: Re: bash prompt question
Date: 6 Jul 2025 23:58:08 GMT
Lines: 28
Message-ID: <md0gsfFer35U2@mid.individual.net>
References: <vcguof$hca7$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net Z+a4Bq37lNY6KP+iV9a5jwWFBKiMYfvar/DxXiNIj4Mna6M71l
Cancel-Lock: sha1:eCxeTbn28g31SXWoe0v2992hPsA= sha256:iGs+mq8H+FhacpuVVZVSAW2sh6FF7AqJbcolr6w3xOM=
User-Agent: slrn/1.0.3 (Linux)

On 2024-09-19, François 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