"local" is a shell reserved word, isn't it?

Paul Smith paul at mad-scientist.net
Mon Nov 22 19:28:56 UTC 2010


On Mon, 2010-11-22 at 18:55 +0100, Cristian Ionescu-Idbohrn wrote:
> > But, either way it doesn't change my answer since the question was why
> > different shells don't all treat "local" as a reserved word.
> 
> And, maybe not so.  The question is:
> 
>         "local" is a shell reserved word, isn't it?
> 
> It does not say "other shells should treat 'local' as a reserved word",
> does it?  It merily hints more at "those shell thet _do_ implement 'local'
> might just as well do it right", doesn't it?

Honestly, no, that's not how I interpreted the original question at all.
If the real question was, "these shells all implement 'local' but they
behave differently; why aren't they all the same?" then my answer was
clearly off-base.  But that's not how it read (to me).

I should point out that there are currently proposals to add some kind
of variable localization feature to the POSIX sh standard.  However,
it's very tricky.  Just one example: are local variables statically
scoped or dynamically scoped?  Then there are a large number of odd
corner cases that have to be considered.



More information about the busybox mailing list