[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Escaping special characters for *nix file path

Subject: Re: Escaping special characters for *nix file path
From: Markus Abt <abt@xxxxxxxx>
Date: Sun, 29 Jul 2012 17:52:25 +0200
Re:  Escaping special characters for *nix file path
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.