From: Iain Patterson Date: Wed, 10 Mar 2010 14:20:00 +0000 (+0000) Subject: SCREENDIR checks. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=b0dc723863560322fab286f028e09d51981d174c;p=profile.git SCREENDIR checks. Use bash builtin -g to check for setgid screen. Make SCREENDIR if it doesn't already exist. --- diff --git a/.profile.d/screen.bashrc b/.profile.d/screen.bashrc index 440395e..beba505 100644 --- a/.profile.d/screen.bashrc +++ b/.profile.d/screen.bashrc @@ -1,12 +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 (but not under sudo). - if ! ls -l "$screen" | cut -d ' ' -f 1 | grep s >/dev/null; then + # Override SCREENDIR iff screen is not setgid (but not under sudo). + if [ ! -g "$screen" ]; then if [ -n "$SUDO_USER" ]; then unset SCREENDIR else - export SCREENDIR="${PROFILE_HOME:-~}/.screen/$HOSTNAME" + export SCREENDIR="~/.screen/$HOSTNAME" + mkdir -p "$SCREENDIR" fi fi