Date: Fri, 26 Jun 2026 04:11:40 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 296207] bin/sh: Don't inherit variables declared local by default Message-ID: <bug-296207-227-BOK2uGEMKr@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-296207-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296207 pprocacci@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pprocacci@gmail.com --- Comment #1 from pprocacci@gmail.com --- "The vast majority of shells don't do that." -- This simply isn't true. - sh (ash-derived) - dash (Debian/Ubuntu default sh) - BusyBox ash - mksh (MirBSD Korn shell) - pdksh (Public Domain Korn Shell) - zsh All the above shells do exactly as you describe. They inherit the callers variable stack. Outside of bash I don't know of a single shell that does this. If you want portability, the answer is 'local myvar=""'. That works everywhere. -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-296207-227-BOK2uGEMKr>
