Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to substitute empty array element, or empty string
- X-seq: zsh-users 22613
- From: Chet Ramey <chet.ramey@xxxxxxxx>
- To: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>, Peter Stephenson <p.stephenson@xxxxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: How to substitute empty array element, or empty string
- Date: Sat, 25 Mar 2017 14:59:23 -0400
- Cc: chet.ramey@xxxxxxxx
- In-reply-to: <etPan.58d60c4f.6b8b4567.17199@MacMini.local>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: ITS, Case Western Reserve University
- References: <CGME20170322075332epcas3p4a32050e48ad0f94be13134b560f17715@epcas3p4.samsung.com> <etPan.58d22d29.6b8b4567.10ab3@MacMini.local> <20170322095212.2ff2dec8@pwslap01u.europe.root.pri> <etPan.58d5027c.6b8b4567.166db@MacMini.local> <20170324114903.5bce97c1@pwslap01u.europe.root.pri> <etPan.58d60c4f.6b8b4567.17199@MacMini.local>
- Reply-to: chet.ramey@xxxxxxxx
On 3/25/17 2:21 AM, Sebastian Gniazdowski wrote:
> On 24 marca 2017 at 12:50:43, Peter Stephenson (p.stephenson@xxxxxxxxxxx) 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@xxxxxxxx http://cnswww.cns.cwru.edu/~chet/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author