From f1c49253d17cbaab69af99523a05d31ae25bce51 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 24 Feb 2025 11:35:09 -0600 Subject: [PATCH] fix SHLVL increment (getvar() returns value, not name=value) --- toys/pending/sh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/pending/sh.c b/toys/pending/sh.c index dd1c5dd2..96368b5d 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -4327,7 +4327,7 @@ static void subshell_setup(void) else { char buf[16]; - sprintf(buf, "%u", atoi(ss+6)+1); + sprintf(buf, "%u", atoi(ss)+1); setvarval("SHLVL", buf)->flags |= VAR_EXPORT; } if (dashi() && !getvar("PS1")) setvarval("PS1", "$ "); // "\\s-\\v$ " -- 2.39.5