On 2022-10-20 11:44, Roman Perepelitsa wrote:
USER` behaves differently depending on whether typeset_silent is set or not. You tested `typeset USER` in an environment where this option is set and then in another environment where it's unset, and got different results.
file 'test':
function ii ()
{
setopt typeset_silent
var=$(typeset USER)
print set in function $var
unsetopt typeset_silent
var=$(typeset USER)
print unset in function $var
}
setopt typeset_silent
var=$(typeset USER)
print set in script $var
unsetopt typeset_silent
var=$(typeset USER)
print unset in script $var
. test; ii
set in script
unset in script USER=root
set in function
unset in function
... confused.