[LUNI] Customize the PS1 prompt
Mike Crawford
mike at tuxnami.org
Thu Jun 5 18:57:01 CDT 2003
On Thu, 2003-06-05 at 17:29, doug_dallmer wrote:
> I am trying to customize the PS1 prompt to include the full path that it is
> currently in (ie: a "pwd" command) & ( including `pwd` doesn't work).
>
> According to the RedHat Linux 8 Bible I have this should be the inclusion of
> the "\w"; however it only returns a "~" in the prompt. When I use a "\W" I
> get the current workng directory as expected. This happens in both the 2.2
> and the 2.4 kernels.
>
> Any ideas about fixing it?
>
Hrm... well, \w and \W are your only good choices. I wouldn't put a
command into PS1 to evaluate every time, it's going to screw up $? .
Doing something like PS1='`pwd`\\$' will have pwd evaluated each time,
but that, as I said, screws up $?, it will always report 0, or at least
it did that when I created my uber prompt.
export PS1="\[\e[30;1m\][\[\e[35;1m\]\$?\[\e[30;1m\]]
\[\e[0m\]\[\e[31m\]\h\[\e[37m\]:\[\e[34;1m\]\w\[\e[30;1m\]\\$
\[\e[0m\e7\e[1G\e[1H\e[1K\e[30;1m[\e[33m\j\e[30;1m]
[\e[32;1m\!\e[30;1m] [\e[36m\u\e[30;1m] [\e[31;1m\d\e[30;1m]
[\e[35m\@\e[30;1m] [\e[0m\e[34m`uname -sr`\e[30;1m]\e8\]"
(there are spaces at each of the newlines)
mike
More information about the luni
mailing list