Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Getting Bash\XTerm to show the full path.

5 views
Skip to first unread message

Anders Jensen

unread,
Feb 28, 2005, 5:49:43 AM2/28/05
to
> Long answer: man bash
> Short answer: in ~/.bash_profile
> export PS1="\w> "

Thanks... I use this line:

export PS1="\h:\w \u\$> "

.. but when I "su" to root, it still writes $ as the groupsign
eventhough it should have been a #? /u writes correctly the username as
root.

pip

unread,
Feb 28, 2005, 12:43:31 PM2/28/05
to
Anders Jensen <aj561...@hotmail.com> writes:

I have this in my /etc/profile:

if [ `/usr/bin/whoami` = 'root' ]
then
# Do not set PS1 for dumb terminals
if [ "$TERM" != 'dumb' ] && [ -n "$BASH" ]
then
export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$
\[\033[00m\]'
fi
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
else
# Do not set PS1 for dumb terminals
if [ "$TERM" != 'dumb' ] && [ -n "$BASH" ]
then
export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$
\[\033[00m\]'
fi
export PATH="/bin:/usr/bin:${PATH}"
fi

note the export statements should all be on one line. Use 'su -' when
switching users. The above colourises the prompt too if you are into
that sort of thing.

Cheers,

Pip

Anders Jensen

unread,
Feb 28, 2005, 3:22:05 PM2/28/05
to
> note the export statements should all be on one line. Use 'su -' when
> switching users. The above colourises the prompt too if you are into
> that sort of thing.

It is still the same (it really does nothing else than changing some
colors).

pip

unread,
Feb 28, 2005, 4:24:47 PM2/28/05
to
Anders Jensen <aj561...@hotmail.com> writes:

I don't know if I have misunderstood your question having joined so
late. If the problem is simply that as root your prompt doesn't end
with a '#' then the code I gave you should work. Maybe a good read of
the manual for your shell would turn up more intelligent and indeed
useful answers than I can.

Cheers,

Pip

0 new messages