On Mon, Jun 27, 2011 at 11:00 AM, Christopher Zimmermann
<[email protected]> wrote:
> Hi,
>
> ksh(1) states this:
>
> Functions defined with the function reserved word are treated differently
> in the following ways from functions defined with the () notation:
>
> [...]
>
> o Parameter assignments preceding function calls are not kept in the
> shell environment (executing Bourne-style functions will keep
> assignments).
>
> This does not work for me:
>
> $ i=foo
> $ function fun { echo $i; }
That doesn't count as an assignment preceding a function call.
Compare with what happens running the test below.
function f1 {
echo $i;
}
f2() {
echo $i;
}
i=foo
i=1 f1
f1
i=bar
i=2 f2
f2