From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26611 invoked by alias); 10 Jan 2017 18:52:21 -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: 40326 Received: (qmail 10013 invoked from network); 10 Jan 2017 18:52:21 -0000 X-Qmail-Scanner-Diagnostics: from forward5h.cmail.yandex.net 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(87.250.230.20):SA:0(-0.7/5.0):. Processed in 1.79495 secs); 10 Jan 2017 18:52:21 -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=-0.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: kp-pav@yandex.ru X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf-ipv4.yandex.ru designates 87.250.230.20 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1484073718; bh=qVVnIb8kXDsyfZJ46F7u5TtcPvFbTcbfGR3obKY51uo=; h=From:To:In-Reply-To:References:Subject:Message-Id:Date; b=V9RwrNSboOqf84Rkzs3X8z34rqp5zBskUGLxEkvLxr82XC/72fiko2MyACYsOUHtj 30jQNwrDsUfKsIfXQV4WZP2/e2X/Nyk8we4pwHV03kY9LPp5sj1MOWtiN0XOl3xLok xlOZo2jGtj9oWv0IzAiwnhc3EVbZ0IS3ciw8jJYY= Authentication-Results: mxback10o.mail.yandex.net; dkim=pass header.i=@yandex.ru From: "Nikolay Aleksandrovich Pavlov (ZyX)" To: Ronald Fischer , Peter Stephenson , "zsh-workers@zsh.org" In-Reply-To: <1484063743.4187904.843219497.103F256C@webmail.messagingengine.com> References: <1484062500.4181388.843189521.58854935@webmail.messagingengine.com> <20170110154318.58b2b994@pwslap01u.europe.root.pri> <1484063743.4187904.843219497.103F256C@webmail.messagingengine.com> Subject: Re: Bug in parameter expansion with :- ? MIME-Version: 1.0 Message-Id: <3499521484073718@web13o.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 10 Jan 2017 21:41:58 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 10.01.2017, 18:56, "Ronald Fischer" : > On Tue, Jan 10, 2017, at 16:43, Peter Stephenson wrote: >>  On Tue, 10 Jan 2017 16:35:00 +0100 >>  Ronald Fischer wrote: >> >>  > This expands correctly to a '+': >>  > >>  > ${unset_variable:-+} >>  > >>  > This however doesn't expand to a '-', but to the empty string: >>  > >>  > ${unset_variable:--} >> >>  You may be getting into confusions with options to builtins rather than >>  the expansion. >> >>  % print -r -- ${unset_variable:--} >>  - > > Yes I do! You are right - not a bug! > > Ronald For checking what argument is literally I would suggest `printf '<%s>' $arg` instead: this will show trailing spaces due to `<>` around `%s`, let you distinguish between variable accidentally becoming an array and determine which strings are in one array item exactly (`printf '<%s>' 1 2` results in `<1><2>`, harder to miss then a space). And this also does not look like you are fighting with zsh (`-r` and `--` are there to prevent some misinterpretations).