Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to have function local variable but must behave just a simple one



On Sat, Aug 26, 2023 at 12:34 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> Zsh doesn't have the equivalent. You'll have to use a global parameter.

More generically speaking, shells typically use dynamic scoping rather
than lexical scoping, which means a variable only persists until the
scope where it is declared finishes, and while it persists it is
available to all deeper scopes.  The zsh/param/private module changes
some of the availability rules, but nothing changes the persistence.




Messages sorted by: Reverse Date, Date, Thread, Author