Oh joy, a bug in the work-around (and no way to edit the post).
Please add "-a" to the egrep command line to avoid a warning due to the nul terminator in cmdline.
CORRECTED work-around for .bashrc :
i_am_toplevel() {
case "$SHLVL" in
1) return 0 ;;
3) return 1 ;;
2) # HACK FOR Ubuntu 16.10, 17.04 ... where SHLVL=2 at top
if egrep -as '(terminal-server|^xterm)' /proc/$PPID/cmdline ; then
return 0
fi
;;
esac
return 1
}
Oh joy, a bug in the work-around (and no way to edit the post).
Please add "-a" to the egrep command line to avoid a warning due to the nul terminator in cmdline.
CORRECTED work-around for .bashrc :
i_am_toplevel() { server| ^xterm) ' /proc/$PPID/cmdline ; then
case "$SHLVL" in
1) return 0 ;;
3) return 1 ;;
2) # HACK FOR Ubuntu 16.10, 17.04 ... where SHLVL=2 at top
if egrep -as '(terminal-
return 0
fi
;;
esac
return 1
}