Message 97454 - Python tracker (original) (raw)
I'm attaching a patch that changes quote() logic. It also fixes #7476, the empty argument case.
Strings with unsafe characters are now always quoted with single quotes. Single quotes themselves are replaced by a single quote in double quotes, so that
te$t'quoting
becomes
'te$t'"'"'quoting'
which I believe is portable across all commonly used shells.
(Another implementation would be to just backslash-quote all unsafe chars, but it makes for less readable results.)
Assigning to David for review -- you recently claimed to like shells :)