diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2000-04-13 14:22:47 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2000-04-13 14:22:47 +0000 |
commit | cf92384eac7c961d96a9bf3bde3df8f8427b45bc (patch) | |
tree | 9c8f88188a053a6979e40e1661df1e8069403de6 /Doc | |
parent | b692ed1b9d19d10646d3870bb3b9b301216bddf7 (diff) | |
download | zsh-cf92384eac7c961d96a9bf3bde3df8f8427b45bc.tar.gz zsh-cf92384eac7c961d96a9bf3bde3df8f8427b45bc.tar.xz zsh-cf92384eac7c961d96a9bf3bde3df8f8427b45bc.zip |
10738: pws: local parameters can be exported
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Zsh/builtins.yo | 15 | ||||
-rw-r--r-- | Doc/Zsh/params.yo | 18 |
2 files changed, 16 insertions, 17 deletions
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index cb7372cc5..0eadbc596 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -595,9 +595,10 @@ sitem([var(mm)tt(:)]var(ss))(minutes and seconds) endsitem() ) findex(local) -item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFLRUZahilrtu) [var(n)]] [ var(name)[tt(=)var(value)] ] ...)( -Same as tt(typeset), except that the options tt(-g), tt(-x) and -tt(-f) are not permitted. +item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFLRUZahilrtux) [var(n)]] [ var(name)[tt(=)var(value)] ] ...)( +Same as tt(typeset), except that the options tt(-g), and +tt(-f) are not permitted. In this case the tt(-x) option does not force +the use of tt(-g), i.e. exported variables will be local to functions. ) findex(log) vindex(watch, use of) @@ -1003,9 +1004,7 @@ var(name) (even those that already exist), and is unset again when the function completes. See ifzman(`Local Parameters' in zmanref(zshparam))\ ifnzman(noderef(Local Parameters))\ -. Local parameters are not exported unless tt(ALL_EXPORT) is set, in -which case the parameter is exported em(only) when var(name) does not -already exist. The same rules apply to special shell parameters, which +. The same rules apply to special shell parameters, which retain their special attributes when made local. For each var(name)tt(=)var(value) assignment, the parameter @@ -1161,7 +1160,9 @@ This flag has a different meaning when used with tt(-f); see above. ) item(tt(-x))( Mark for automatic export to the environment of subsequently -executed commands. +executed commands. Currently this implies the option tt(-g), unless tt(+g) +is also explicitly given, in other words the parameter is not made local to +the enclosing function. This is for compatibility with other shells. ) enditem() ) diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index c6571f38f..ac90d095d 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -215,21 +215,19 @@ any outer parameter of the same name remains hidden. Special parameters may also be made local; they retain their special attributes unless either the existing or the newly-created parameter -has the tt(-h) (hide) attribute. This may have unexpected effects. -Firstly, there is no default value, so if there is no assigment at the +has the tt(-h) (hide) attribute. This may have unexpected effects: +there is no default value, so if there is no assigment at the point the variable is made local, it will be set to an empty value (or zero -in the case of integers). Secondly, special parameters which are made -local will not be exported (as with other parameters), so that the global -value of the parameter remains present in the environment if it is already -there. This should be particularly noted in the case of tt(PATH): the -shell will use the local version of tt(PATH) for finding programmes, but -programmes using the shell's environment will inherit the global version. +in the case of integers). The following: example(typeset PATH=/new/directory:$PATH) -is valid for temporarily allowing the shell to find the programs in -tt(/new/directory) inside a function. +is valid for temporarily allowing the shell or programmes called from it to +find the programs in tt(/new/directory) inside a function. + +Note that the restriction in older versions of zsh that local parameters +were never exported has been removed. texinode(Parameters Set By The Shell)(Parameters Used By The Shell)(Local Parameters)(Parameters) sect(Parameters Set By The Shell) |