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

Why a '-quoted string isn't respected by // subst, while \-quoted is?



Hi,
I'm storing a pattern in a var:

E="0='\${\${\\(M\\)\${0::=\${\\(%\\):-%x}}:\\#/\\*}:-\$PWD/\$0}'"

to then match it against:

Q='0=${${(M)${0::=${(%):-%x}}:#/*}:-$PWD/$0}'

with // substitution:

printf %s\\n $E $Q ${Q//$~E/q}

The result is no match. However, if I instead quote the string with \:

E='0=${${\(M\)${0::=${\(%\):-%x}}:\#/*}:-$PWD/$0}'  

(only ),(,#,* are quoted), then it matches. Why? It would be more comfortable to simply quote with ' the whole string...

--
Best regards,
Sebastian Gniazdowski



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