SHLVL in ash
Ron Yorston
rmy at tigress.co.uk
Thu Jan 2 16:55:51 UTC 2014
I've just been having a look at 1.22.0. I note that BusyBox ash doesn't
export SHLVL. If whatever invokes ash doesn't have SHLVL set or doesn't
have it exported each new shell has a SHLVL of 1:
[rmy at f14vm busybox]$ cp busybox sh
[rmy at f14vm busybox]$ unset SHLVL
[rmy at f14vm busybox]$ ./sh
~/busybox $ echo $SHLVL
1
~/busybox $ ./sh
~/busybox $ echo $SHLVL
1
~/busybox $ exit
~/busybox $ exit
[rmy at f14vm busybox]$ SHLVL=1
[rmy at f14vm busybox]$ ./sh
~/busybox $ echo $SHLVL
1
~/busybox $ ./sh
~/busybox $ echo $SHLVL
1
~/busybox $ exit
~/busybox $ exit
[rmy at f14vm busybox]$ export SHLVL
[rmy at f14vm busybox]$ ./sh
~/busybox $ echo $SHLVL
2
~/busybox $ ./sh
~/busybox $ echo $SHLVL
3
~/busybox $
I don't know if this is likely to be important to anyone, but if it is
perhaps SHLVL should be exported.
Ron
More information about the busybox
mailing list