Daniel,

On Tuesday May 28, 2002 01:21, you said something about:
> well i went back to the site
> and you were right, all the colours and things i needed were there
> i found out how to put the time into the prompt
> as well as the current directory using ${PWD}
> but there's a snag:
>
> say i'm in /tmp/ and i type this:
>
>   PS1="[\t \u@\[\033[1;31m\]\h\[\033[0m\] ${PWD}]\$
>
> my prompt then looks like this:
>
>   [09:51:00 root@machinename /tmp/]$
>
> problem 1:  isn't the "$" supposed to be a "#" while root?
> but then i type this:
>
>   cd ../home/
>
> and my prompt still says this:
>
>   [09:51:35 root@machinename /tmp/]$
>
> problem 2: the time gets updated, but no the current dir.
>

Try it like this.

PS1=$'[\\t \\u@\[\033[1;31m\]\\h\[\033[0m\] ${PWD}]\\$ '

The reason the directory was not changing was because it was not reevaluating 
$PWD each time the prompt was issued.

Quoting, slashes, etc. are all very important and can cause all sorts of 
problems at any given time or circumstance. It needs to be carefully 
followed. The examples section of that HOWTO are one of the best places to 
cut and paste stuff out of.

Man bash to learn more about how bash expands different types of quotes and 
how to escape (using slashes, back-slashes, etc.) different things at 
different times. Of course there are also some good bash HOWTOs as well.

-- 
Brian Ashe                                                     CTO
Dee-Web Software Services, LLC.                  [EMAIL PROTECTED]



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to