I hope this bug will be fixed before the next release.  But meanwhile,
here is a nasty workaround which can be used in bash startup scripts:

i_am_toplevel() {
  case "$SHLVL" in
    1) return 0 ;;
    3) return 1 ;;  # (optimize this case)
    2) # HACK FOR Ubuntu 16.10, 17.04 ... where SHLVL=2 at top
       if egrep -s '(terminal-server|^xterm)' /proc/$PPID/cmdline ; then
         return 0
       fi
       ;;
  esac
  return 1
}

Then say "if i_am_toplevel ; then ... "
instead of "if [ $SHLVL -eq 1 ] ..."

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1707977

Title:
  SHLVL=2 in outermost shell in unity terminals (REGRESSION)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1707977/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to