Package: bash
Version: 4.3-11+b1
Severity: minor
Tags: patch

Dear Maintainer,

Bash's default /etc/bash.bashrc 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


-- System Information:
Debian Release: 8.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages bash depends on:
ii  base-files   8
ii  dash         0.5.7-4+b1
ii  debianutils  4.4+b1
ii  libc6        2.19-13
ii  libncurses5  5.9+20140913-1+b1
ii  libtinfo5    5.9+20140913-1+b1

Versions of packages bash recommends:
ii  bash-completion  1:2.1-4

Versions of packages bash suggests:
ii  bash-doc  4.3-11

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to