From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16483 invoked by alias); 29 Oct 2016 08:11:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39756 Received: (qmail 7248 invoked from network); 29 Oct 2016 08:11:44 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(37.59.109.123):SA:0(-1.4/5.0):. Processed in 0.480316 secs); 29 Oct 2016 08:11:44 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at inlv.org does not designate permitted sender hosts) Subject: Re: exported unset variables [was: 'export -p' lacks POSIX output] To: Bart Schaefer , Zsh hackers list References: <9a5b08ae-f45b-d1df-9b3b-dd47a0f62412@inlv.org> <161028143156.ZM19947@torch.brasslantern.com> <161028171859.ZM2366@torch.brasslantern.com> From: Martijn Dekker Message-ID: <6db9e2a5-8f0b-71a2-95e6-8a8bbf4a281e@inlv.org> Date: Sat, 29 Oct 2016 09:11:32 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <161028171859.ZM2366@torch.brasslantern.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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. Understood. > 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 unset export var % var=; echo ${var+set} ${var-unset}; typeset -p var set 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 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_03 (#9) does not distinguish between interactive and non-interactive shells. Thanks, - M.