Chet Ramey <[email protected]> wrote:
> > ksh88 has POSIX compliant functions, see:
> >
> > ksh -c 'a=0; a() { a=12; } ; a; echo $a'
>
> Nobody is arguing whether or not unqualified assignment statements in ksh88
> modify global variables. This is not the behavior that makes ksh88
> functions non-conformant.
>
> I included the text above to note that Korn doesn't consider ksh88
> functions conformant and that he needed to modify ksh behavior for
> conformance.
>
> The portion about "local variables" in the quoted text means that
> the presence of the `typeset' command doesn't make a variable local:
> there are no local variables in ksh93 posix functions at all.
The problem with ksh93 is that it does not allow to create variables with
local scope inside POSIX/Bourne functions while ksh88 allows to make a variable
"local" by using the "local builtin" that really is a builtin alias to
"typeset":
ksh -c 'a=0; a() { local a; a=12; } ; a; echo $a'
prints 0 with ksh88.
But this is what you get with ksh93:
ksh93 -c 'a=0; a() { local a; a=12; } ; a; echo $a'
ksh93[1]: local: not found [No such file or directory]
12
Linux distros decided (while moving to "dash" as /bin/sh) that they "need" a
basic POSIX shell that in addition supports the "local" feature.
Jörg
--
EMail:[email protected] (home) Jörg Schilling D-13353 Berlin
[email protected] (work) Blog: http://schily.blogspot.com/
URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'