bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash default /etc/bash.bashrc overwrites PS1 even if SUDO_PS1 is set


From: Eric Engstrom
Subject: Re: Bash default /etc/bash.bashrc overwrites PS1 even if SUDO_PS1 is set
Date: Mon, 18 Dec 2017 14:40:04 -0600
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.0.1

doh - thanks - didn't think of that, and that makes more sense.

Nevermind then.

On 12/18/17 1:11 PM, DJ Mills wrote:
> 
> 
> On Mon, Dec 18, 2017 at 11:25 AM, Eric Engstrom <engstrom@mtu.net
> <mailto:engstrom@mtu.net>> wrote:
> 
>     Dear Bash Maintainer(s),
> 
>     Bash's default /etc/bash.bashrc (on debian systems at least) blindly
>     overwrites PS1 even if it's been set already.  This makes it difficult
>     to use sudo's abiltity to set PS1 via the SUDO_PS1 env var.
> 
>     Perhaps overly simplistic, but the following modification seems to work
>     in all the situations I've tried:
> 
>         --- /etc/bash.bashrc.orig       2014-11-12 17:08:49.000000000 -0600
>         +++ /etc/bash.bashrc    2015-06-24 12:13:36.445096411 -0500
>         @@ -16,7 +16,10 @@
>          fi
> 
>          # set a fancy prompt (non-color, overwrite the one in /etc/profile)
>         -PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
>         +# but only if not SUDOing and have SUDO_PS1 set; then assume smart
>     user.
>         +if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then
>         +  PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
>         +fi
> 
>          # Commented out, don't overwrite xterm -T "title" -n "icontitle" by
>     default.
>          # If this is an xterm set the title to user@host:dir
> 
>     Thanks,
>     Eric
>     --
>     Eric Engstrom - engstrom@mtu.net <mailto:engstrom@mtu.net> - PGP
>     Key: 0xC440235DF11F74CF
>     $/='O'; eval ($_='print $_^pack"c25",<DATA>');
>     __END__
>     58O7O26O26O84O65O74O48O42O24O4O17O75O114O6O64O89O2O68O93O39O42O49O51O52
> 
> 
> I think you'll find that the string "bash.bashrc" doesn't exist in any
> bash documentation. It's a thing that's
> been added by your OS/distro. You need to talk to the Debian maintainer. 
> 

-- 
Eric Engstrom - engstrom@mtu.net - PGP Key: 0xC440235DF11F74CF
$/='O'; eval ($_='print $_^pack"c25",<DATA>');
__END__
58O7O26O26O84O65O74O48O42O24O4O17O75O114O6O64O89O2O68O93O39O42O49O51O52



reply via email to

[Prev in Thread] Current Thread [Next in Thread]