tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Add static local vars to sh(1) ?



Robert Elz <kre%munnari.oz.au@localhost> wrote:

>     The -S flag causes the local variable to be static.  When a
>     function containing such variables returns, then just before the
>     previous values are restored, the current value and attributes of
>     each such variable are saved.  When the ``local -S variable''

A nit-pick.. This doesn't seem to mention what happens when the
function is called recursively.  I assume it does the right thing, but
the paragraph wording is organized around "saving" its value and it
only explicitly mentions returning from the function as saving the
variable's value.


>     command is executed, if a value for variable had previously been
>     saved, then after its outside value has been preserved, the
>     previous value and attributes of variable are restored, and the
>     -I, -N, and -x flags, and any initialization of the variable
>     requested on the local command line, are ignored.  If there was no
>     saved value for variable (from a previous execution of the same
>     function which had executed ``local -S'' with the same variable
>     name) then processing of those flags, and initialization, proceeds
>     as if the -S flag had not been given.

-uwe



Home | Main Index | Thread Index | Old Index