Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Console and PS1 configuration
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
CrEsPo
Tux's lil' helper
Tux's lil' helper


Joined: 15 Mar 2005
Posts: 130
Location: Canada

PostPosted: Sun Aug 27, 2006 2:58 am    Post subject: Console and PS1 configuration Reply with quote

I was configuring my PS1 variable in ~/.bashrc, but I came across a problem. My PS1 variable looks like this:

Code:

PS1="\u \W \$"


The problem is that '\$' is not working correctly, when I'm logged in as root it will still show the '$' symbol instead of the '#' symbol. Does anyone know why it is doing this? I tried searching, but didn't come up with anything. Here's an example of what I mean:

As user
Code:

<username> ~ $


As root
Code:

gentoo ~ $
Back to top
View user's profile Send private message
GenYetiToo
Apprentice
Apprentice


Joined: 03 Feb 2004
Posts: 165
Location: Siegen, Germany

PostPosted: Tue Sep 05, 2006 10:12 am    Post subject: Re: Console and PS1 configuration Reply with quote

CrEsPo wrote:
Code:

PS1="\u \W \$"

The problem is that '\$' is not working correctly, when I'm logged in as root it will still show the '$' symbol instead of the '#' symbol. Does anyone know why it is doing this?

It does this, because $ is a special character and has to be "escaped" using a \
Try:
Code:
PS1="\u \W \\$"
or
Code:
PS1="\u \W '\$'"

M.
_________________
Cats, cats everywhere ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum