From: Iain Patterson Date: Tue, 15 Sep 2009 12:59:34 +0000 (+0100) Subject: Don't use SCREENDIR under sudo. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=41bba1a13e04c472115c71242a2d0ee1549e519b;p=profile.git Don't use SCREENDIR under sudo. If SCREENDIR is set and we sudo the directory will probably be unusable. Unset it if SUDO_USER is defined. --- diff --git a/.profile.d/screen.bashrc b/.profile.d/screen.bashrc index ca08f6e..02026cd 100644 --- a/.profile.d/screen.bashrc +++ b/.profile.d/screen.bashrc @@ -1,9 +1,13 @@ # Fixup screen and define ``session'' if available. screen=$(find_working screen 2>/dev/null) if [ $? = 0 ]; then - # Override SCREENDIR iff screen is not setuid. + # Override SCREENDIR iff screen is not setuid (but not under sudo). if ! ls -l "$screen" | cut -d ' ' -f 1 | grep s >/dev/null; then - export SCREENDIR="$HOME/.screen/$HOSTNAME" + if [ -n "$SUDO_USER" ]; then + unset SCREENDIR + else + export SCREENDIR="$HOME/.screen/$HOSTNAME" + fi fi krenew=$(find_working krenew 2/dev/null)