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

Re: Help in understanding rules of parameter expansion



On Thu, Aug 22, 2024 at 9:23 AM Dhruv Singla <dvsingla.28@xxxxxxxxx> wrote:
>
> I have trouble understanding some joining semantics in the parameter expansion while splitting with the `s` flag. Please take a look at this question.
> https://stackoverflow.com/questions/78897413/zsh-join-after-split-using-s-flag

Looks like a bug to me.

    % foo=AxB
    % bar=${(s.x.)foo}
    % baz=${${(s.x.)foo}}
    % typeset -p bar baz
    typeset bar=AxB
    typeset baz='A B'

I might be missing something but I expect $bar to be the same as $baz.

${=name} also behaves like that.

    % foo=' A   B '
    % bar=${=foo}
    % baz=${${=foo}}
    % typeset -p bar baz
    typeset bar=' A   B '
    typeset baz='A B'

Roman




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