Re: bash prompt question

Liste des GroupesRevenir à cu shell 
Sujet : Re: bash prompt question
De : taviso (at) *nospam* gmail.com (Tavis Ormandy)
Groupes : comp.unix.shell
Date : 07. Jul 2025, 00:58:08
Autres entêtes
Message-ID : <md0gsfFer35U2@mid.individual.net>
References : 1
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

Date Sujet#  Auteur
19 Sep 24 * bash prompt question22François Patte
19 Sep 24 +* Re: bash prompt question6Chris Elvidge
19 Sep 24 i+- Re: bash prompt question1François Patte
23 Sep 24 i`* Re: bash prompt question4Brian Patrie
23 Sep 24 i `* Re: bash prompt question3Geoff Clare
24 Sep 24 i  `* Re: bash prompt question2Brian Patrie
24 Sep 24 i   `- Re: bash prompt question1Geoff Clare
24 Sep 24 +* Re: bash prompt question14Damien Wyart
24 Sep 24 i+* What? (Was: bash prompt question)9Kenny McCormack
24 Sep 24 ii+* Re: What?5Damien Wyart
24 Sep 24 iii+- Re: What?1Axel Reichert
24 Sep 24 iii+- Re: What?1Kenny McCormack
24 Sep 24 iii+- Re: What?1Janis Papanagnou
25 Sep 24 iii`- Re: What?1Damien Wyart
25 Sep 24 ii`* Re: What?3Damien Wyart
25 Sep 24 ii +- Re: What?1Janis Papanagnou
25 Sep 24 ii `- Re: What?1Damien Wyart
24 Sep 24 i+- Re: bash prompt question1Kaz Kylheku
24 Sep 24 i`* Re: bash prompt question3Kaz Kylheku
24 Sep 24 i +- Re: bash prompt question1Kenny McCormack
25 Sep 24 i `- Re: bash prompt question1Damien Wyart
7 Jul 25 `- Re: bash prompt question1Tavis Ormandy

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal