Use bash builtin -g to check for setgid screen.
Make SCREENDIR if it doesn't already exist.
# 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