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

Re: exported unset variables [was: 'export -p' lacks POSIX output]



Op 28-10-16 om 22:31 schreef Bart Schaefer:
> On Oct 28, 10:00pm, Martijn Dekker wrote:
> }
> } In zsh, however, variables are automatically set to the empty value upon
> } being exported.
> 
> That's no longer true subsequent to my "export -p" patch:
> 
> torch% export XYZPDQ
> torch% export -p | grep XYZPDQ
> export XYZPDQ
> torch% printenv | grep XYZPDQ
> torch% 
> 
> Unless there's some other nuance here that I'm missing?

Hmm... With current git version:

$ PS1='%% ' Src/zsh -f -o posixbuiltins
% unset -v var
% export var
% echo ${var+s}  # this shows it as set (should be unset)
s
% export -p var  # but this shows it as unset
export var
% var=''
% export -p var  # 'export' knows if it's set or not, ${var+s} doesn't?
export var=''

So, currently, ${var+s} doesn't correctly represent that an exported
'var' is unset.

(Also, is it correct/expected behaviour that zsh doesn't parse comments
on the interactive command line? Blindly copying/pasting the above won't
work for that reason.)

Thanks,

- M.



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