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

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

Op 29-10-16 om 01:18 schreef Bart Schaefer:
> All my patch did was cause "export -p" to output the state of the
> environment variable instead of the state of the shell variable.


> See if the patch below will help.

Seems like it's about halfway there:

$ PS1='%% ' Src/zsh -f -o posixbuiltins
% export var; echo ${var+set} ${var-unset}; typeset -p var
export var
% var=; echo ${var+set} ${var-unset}; typeset -p var
typeset var=''

The variable name loses its export attribute upon assignment; it should
retain it.

> } (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.)
> Yes, the option INTERACTIVE_COMMENTS has to be set to recognize comments
> at the command line.  Should this be on in POSIX mode?

I think so. All the other shells recognise comments in interactive mode
by default. The spec for comments at
(#9) does not distinguish between interactive and non-interactive shells.


- M.

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