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

Re: Trying to reverse a word.



On 20/10/2007, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Oct 20, 12:01am, Mikael Magnusson wrote:
> } Subject: Trying to reverse a word.
> }
> } % echo "${(j::)${(Oa)${(s::):-hello}}}"
> } h e l l o
> } What the heck is going on here?
>
> The double quotes cause ${(Oa)${(s::):-hello}} to be joined with the
> default IFS before the (j::) is ever applied.  Add an (@) to force
> that array to remain an array:
>
> echo "${(j::)${(@Oa)${(s::):-hello}}}"

Aha, thanks. Something of a mystery to me how the quotes outside the
outermost ${} can affect something inside, but maybe it's better not
to know. ${(j::)${(#)${(@Oa)${(s:-:):-41-45-58}}}}
(why does that break in double quotes? heh).

-- 
Mikael Magnusson



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