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

Re: append to history entry?



On Dec 28,  5:28am, Daniel Shahaf wrote:
}
} Actually, there's just one escaping: instead of using «${foo}»,
} use «${(q)foo}» if $foo is a scalar and $«{${(q)foo}}» if it is an
} array.

Unfortunately that's not quite right: you mean «${${(q)foo[@]}}» or
«${${(@q)foo}}» -- if it's just "an array" then it'll be joined
before (q)-ting.

} I didn't get it right, but Bart was right all along.  Anyway, the rules
} are simple:
} 
} 1) When using the 'print' builtin, always pass '-r --'.

I'd avoid this kind of blanket statement, because it leads to the question,
"if you should ALWAYS do that, why doesn't print just do that without being
told?"

} 2) When interpolating a variable into a string that will be parsed as
} zsh code, escape that variable using ${${(q)}}.

... and put that (@) or [@] in there so the (q) applies to each array
element separately ... unless that's not what you mean.



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