[Bug 296207] bin/sh: Don't inherit variables declared local by default

[email protected]
Newsgroups gmane.os.freebsd.bugs
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296207

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from [email protected] ---
"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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.