xsl-list
[Top] [All Lists]

Re: [xsl] Escaping special characters for *nix file path

2012-07-29 10:52:42
Wolfgang Laun wrote:
A relatively safe way would be to enclose the path name in apostrophes
(') and escape all contained apostrophes and backslashes with a
backslash.

That my work in some shell, but not in bash, for example.
In bash, in a single-qouted argument, backslash is a normal character, 
not an escape character. As a consequence, the apostrohpe cannot 
be included directly, since it cannot be escaped.

Instead, the apostrophe has to be replaced by either
apos-backsl-apos-apos ('\'') or apos-quot-apos-qout-apos ('"'"'):

$ echo $SHELL
/bin/bash
$ touch 'a b"c$d!e?f&g*h\i'\''1'
$ touch 'a b"c$d!e?f&g*h\i'"'"'2'
$ ls -1
a b"c$d!e?f&g*h\i'1
a b"c$d!e?f&g*h\i'2

Markus


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--