I’m trying to make an esc function for echoing stuff containing special chars without having to use quotes.
Why does
evaluate to
?
It seems to be doing the ^ replacement after doing the | replacement.
evaluates to
as expected. My full esc function works as expected if the ^ replacement is omitted.
(n.b. To enter this function at the command line, double all ^s)
Why does
Code:
echo %@replace[^|,^^|,%@replace[^^,^^^^,foo|bar]]
Code:
foo^^|bar
It seems to be doing the ^ replacement after doing the | replacement.
Code:
echo %@replace[^|,^^|,foo|bar]
Code:
foo^|bar
Code:
27.6G C:\Users\johnb\tmp> eset /f esc
esc=%@replace[^>,^^>,%@replace[^<,^^<,%@replace[^&,^^&,%@replace[^|,^^|,%$]]]]
27.6G C:\Users\johnb\tmp> echo %@esc[&|<>]
&|<>
Code:
function esc=`%@replace[^^>,^^^^>,%@replace[^^<,^^^^<,%@replace[^^&,^^^^&,%@replace[^^|,^^^^|,%$]]]]`