Re: Passing variables by reference conflicts with local
From:
Greg Wooledge
Subject:
Re: Passing variables by reference conflicts with local
Date:
Thu, 26 Apr 2012 15:46:04 -0400
User-agent:
Mutt/1.4.2.3i
On Thu, Apr 26, 2012 at 01:37:57PM -0600, Bill Gradwohl wrote:
> When the child creates a global to pass back information, and then
> terminates, the parent had no control over that variables creation and is
> now stuck with something in the global name space that via the hierarchy of
> calls, it doesn't properly own. I would never purposely write code that did
> that, and was surprised that bash allows it.
All variables are global by default. Local variables are a special
bash feature. POSIX shells don't even necessarily *have* the capability
of making local variables.
Remember, bash is a shell. It also has a few features that you'd expect
in a programming language, but it is first and foremost a command
interpreter.