From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13316 invoked by alias); 25 Mar 2017 19:09:07 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22613 Received: (qmail 14750 invoked from network); 25 Mar 2017 19:09:07 -0000 X-Qmail-Scanner-Diagnostics: from mpv1-2015.cwru.edu 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(129.22.103.226):SA:0(-0.0/5.0):. Processed in 2.859663 secs); 25 Mar 2017 19:09:07 -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.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: chet.ramey@case.edu X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at case.edu designates 129.22.103.226 as permitted sender) Reply-To: chet.ramey@case.edu Subject: Re: How to substitute empty array element, or empty string References: <20170322095212.2ff2dec8@pwslap01u.europe.root.pri> <20170324114903.5bce97c1@pwslap01u.europe.root.pri> To: Sebastian Gniazdowski , Peter Stephenson , zsh-users@zsh.org Cc: chet.ramey@case.edu From: Chet Ramey Organization: ITS, Case Western Reserve University Message-ID: <815fd7bd-5c0d-72c5-d264-aede1a3a0322@case.edu> Date: Sat, 25 Mar 2017 14:59:23 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Junkmail-Whitelist: YES (by domain whitelist at mpv1-2015.case.edu) On 3/25/17 2:21 AM, Sebastian Gniazdowski wrote: > On 24 marca 2017 at 12:50:43, Peter Stephenson (p.stephenson@samsung.com) wrote: >> [[ '' = * ]] && echo yes >> >> echoes "yes" in bash as well as zsh, so "*" can match an empty string, >> and I don't think the / and // operators are standardised. > > Checked that in ksh: > > % a=""; echo ${a//*/x} > x > % a=( "" ); echo ${a[@]//*/x} > x > % [[ "" = * ]] && echo yes > yes > > It can look like // behavior was bash-driven, and in bash there is the omission for "". This was changed between bash-4.3 and bash-4.4. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/