From: Bernhard Reutner-Fischer Date: Fri, 8 Nov 2013 13:25:24 +0000 (+0100) Subject: ash: Set SHLVL in ASH_BASH_COMPAT X-Git-Tag: 1_22_0~58 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=80f8cdf04ad0e8b37c20aed883b6cbfd6636dbc3;p=oweals%2Fbusybox.git ash: Set SHLVL in ASH_BASH_COMPAT function old new delta ash_main 1456 1505 +49 .rodata 148488 148494 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 55/0) Total: 55 bytes Signed-off-by: Bernhard Reutner-Fischer --- diff --git a/shell/ash.c b/shell/ash.c index f9b4d3fe6..71ef9a690 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -13012,7 +13012,10 @@ init(void) } setvar2("PPID", utoa(getppid())); - +#if ENABLE_ASH_BASH_COMPAT + p = lookupvar("SHLVL"); + setvar2("SHLVL", utoa(p ? atoi(p) + 1 : 1)); +#endif p = lookupvar("PWD"); if (p) { if (*p != '/' || stat(p, &st1) || stat(".", &st2)