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

Re: var=$( typeset "$1" ) ... not within a function.




On 2022-10-20 10:54, Roman Perepelitsa wrote:
The function is a red herring. If you run `unsetopt typeset_silent` in
the function or before invoking it, you'll see the same behavior as
you see in the script. If you read the description of this option,
you'll immediately see that everything works as expected. This option
controls `typeset` in exactly the way you are observing.

But wouldn't my shell settings be inherited by the function?  It may be all as wanted, but it seems anomalous.  Why this special handling for typeset?  I can see that if you are setting or changing something, then the effect within a function will be different so various protections might be in order, but the simple display of an environment variable ... it seems strange.






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