Mike Frysinger wrote:
the difference here being the value in variable "a" after function "f"
finishes executing. i was expecting the behavior of `bash`, not of `sh`. i
cant seem to find anything covering this in the man page except for perhaps
interpreting the meaning of some sections to mean this behavior is allowed.
but i certainly didnt locate anything that would imply behavior of this would
differ across bash and sh ...
-mike
I'd expect "VAR=VAL <simple command>" to behave like in your "bash"
example, in any case (i.e. also for functions!). Just intuitively, I
mean. I don't know any standard documents about it, maybe it is
"implementation defined", as so often.
Dash behaves the same way as your "sh" example, Korn too. Z behaves like
the "bash" example here. So I fear it actually isn't standardized and
you can't operate with functions the same way you operate with separate
processes.
What does Chet, our secret agent in Austin Group, say about this ;-) ?
J.