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

Re: syntax question



On 22 marca 2018 at 02:30:52, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> On Wed, Mar 21, 2018 at 4:15 PM, Ray Andrews wrote:
> > ${${(z)string}[1]}
> >
> > ${(z)string[1]}
> >
> > ... How can that mean anything different?
> 
> Operator precedence. The second one is equivalent to
> ${(z)${string[1]}}, as you observed.

Also, better to use (Az), utilizing your underrated patch, because:

% a='abcd'
% echo ${${(z)a}[1]}
a

-- 
Sebastian Gniazdowski
psprint /at/ zdharma.org



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