Gentoo Archives: gentoo-user

From: Hans-Werner Hilse <hilse@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Bash prompt
Date: Wed, 14 Sep 2005 09:34:51
Message-Id: 20050914113019.76d1fe7f.hilse@web.de
In Reply to: [gentoo-user] Bash prompt by Charles Trois
1 Hi,
2
3 On Wed, 14 Sep 2005 11:15:13 +0200
4 Charles Trois <charles.trois@×××××××.fr> wrote:
5
6 > I am getting confused with profile, bashrc, etc.
7 > The prompt string I want to use is
8 >
9 > PS1="[\u@\h \W]\$ "
10 >
11 > [...]
12 > I thought that /etc/profile should provide the default, but I was
13 > obviously wrong. Trying to mend things, I created two files
14 > /root/.bash_profile and /root/.bashrc, writing just PS1 in each. Now,
15 > logging in as root, the result is
16 >
17 > [root@sirrah root]$
18 >
19 > which is wrong, since "$" appears in place of "#", as though my syntax
20 > of PS1 were incorrect, but I don't see that it is.
21
22 That's probably due to multi level backslash escaping. Because you
23 surrounded the prompt string with "", the backslash isn't surviving the
24 first parser run by bash. You'd need to double it or even triple it
25 (because the "$" may need escaping on the first level, too).
26
27 -hwh
28 --
29 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Bash prompt Willie Wong <wwong@×××××××××.EDU>