bug-bash
[Top][All Lists]
Advanced

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

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


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

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)address@hidden:\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)address@hidden:\w\$ '
    +fi

     # Commented out, don't overwrite xterm -T "title" -n "icontitle" by
default.
     # If this is an xterm set the title to address@hidden:dir

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



reply via email to

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