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

Trying to reverse a word.



I found modify-current-argument a while ago so now I'm making some
silly keybinds for fun and profit. One idea was a bind to reverse a
word, but I'm hitting a confusing issue. Here's what I'm trying:
% echo ${(j::)${(Oa)${(s::):-hello}}}
olleh
Which appears to work fine, BUT, when you give that to
modify-current-argument you just get "h e l l o", and I found it
encloses the string in double quotes:
% echo "${(j::)${(Oa)${(s::):-hello}}}"
h e l l o
What the heck is going on here?
If I remove the Oa part, it goes back to being a single word:
% echo "${(j::)${(s::):-hello}}"
hello
With some other flag there's the same issue:
echo "${(j::)${(U)${(s::):-hello}}}"
H E L L O
the only thing I can come up with that works in double quotes is a
$(), but it seems fragile.
% echo "$(echo ${(j::)${(Oa)${(s::):-hello}}})"
olleh

-- 
Mikael Magnusson



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