On Wed, Sep 14, 2005 at 11:30:19AM +0200, Hans-Werner Hilse wrote:
> Hi,
> 
> On Wed, 14 Sep 2005 11:15:13 +0200
> Charles Trois <[EMAIL PROTECTED]> wrote:
> 
> > I am getting confused with profile, bashrc, etc.
> > The prompt string I want to use is
> > 
> > PS1="[EMAIL PROTECTED] \W]\$ "
> > 
> > [...]
> > I thought that /etc/profile should provide the default, but I was 
> > obviously wrong. Trying to mend things, I created two files 
> > /root/.bash_profile and /root/.bashrc, writing just PS1 in each. Now, 
> > logging in as root, the result is
> > 
> > [EMAIL PROTECTED] root]$
> > 
> > which is wrong, since "$" appears in place of "#", as though my syntax 
> > of PS1 were incorrect, but I don't see that it is.
> 
> That's probably due to multi level backslash escaping. Because you
> surrounded the prompt string with "", the backslash isn't surviving the
> first parser run by bash. You'd need to double it or even triple it
> (because the "$" may need escaping on the first level, too).

Use single quotes if you want to use \$
$ is a reserved character in bash. So when using double quotes, you
need to type \\$

sep wwong # export PS1="[test]\$ "
[test]$ export PS1="[test]\\$ "
[test]# export PS1='[test]\\$ '
[test]$ export PS1='[test]\$ '
[test]# 

W
-- 
"Dude, this is making the same approximation twice in a row. It's like a 
whack-a-mole game."
~DeathMech, Some Student. P-town PHY 205
Sortir en Pantoufles: up 33 days, 15:41
-- 
[email protected] mailing list

Reply via email to