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

Re: How to substitute empty array element, or empty string



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 "".

-- 
Sebastian Gniazdowski
psprint [at] zdharma.org



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