Hi,
On Wed, Feb 11, 2015 at 11:10:24PM +0100, Jiri Horner wrote:
> Problem is caused by name collision in local variables, which are
> apparently not very local in this case (maybe also dash problem?)
Just an additional comment on this: It looks actually as intended that
the initial value is inherited, the manpage state:
Variables may be declared to be local to a function by using a
local command. This should appear as the first statement of a
function, and the syntax is
local [variable | -] ...
Local is implemented as a builtin command.
When a variable is made local, it inherits the initial value and
exported and readonly flags from the variable with the same name
in the surrounding scope, if there is one. Otherwise, the
variable is initially unset. The shell uses dynamic scoping, so
that if you make the variable x local to function f, which then
calls func‐ tion g, references to the variable x made inside g
will refer to the variable x declared inside f, not to the global
variable named x.
Regards,
Salvatore
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]