Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: $PPID not updated when the PPID changes (parent killed)



On 2021-05-17 at 16:15 -0700, Bart Schaefer wrote:
> Aside, it's a bit odd that SHLVL isn't read-only.

Needs to be something which can be unset.

At various points in things such as X11 run files, if SHLVL is still set
then newly launched terminal emulators would start with SHLVL=2, which
is misleading.

I don't recall which generations of changes in the flow (startx, xdm,
etc etc) have introduced what breakage but I recall that any time in
recent years that I've needed to customize X11 start-up, I've ended up
having to explicitly unset SHLVL somewhere.

Here we go, my `.xsessionrc` file has some cruft which for once is only
about 15 years old:

# Sometimes /bin/sh is a shell which sets $SHLVL
if [ ".$SHLVL" != "." ]; then
        echo >&2 "Warning: unsetting \$SHLVL: $SHLVL"
        unset SHLVL
# In addition, if the window manager is invoked via a script which is #!/bin/sh
# then it may be necessary to repair damage therein.  Eg, startxfce4,
# /etc/xdg/xfce4/xinitrc
fi





Messages sorted by: Reverse Date, Date, Thread, Author