[X-Unix] Converting Path Type

Eugene list-themacintoshguy at fsck.net
Fri May 27 02:11:56 PDT 2005


On Thu, May 26, 2005 at 08:32:59PM CDT, Dave Higgins <dave at just4.com> wrote:
: 
: I've searched through dozens of man pages and all over Google but  
: can't seem to find this one...
: 
: Can someone point me to a command line command that would convert a  
: quoted file path to an escaped path? Meaning:
: 
: Convert...
: 
: "/Volumes/Main HD/Dave's Stuff/file.txt"
: 
: to
: 
: /Volumes/Main\ HD/Dave\'s\ Stuff/file.txt

echo "/Volumes/Main HD/Dave's Stuff/file.txt" | sed -e 's/ /\\ /g' -e "s/\\'/\\\\\\'/g"

Of course there are easier ways to do it in other scripting languages,
because you can avoid some/most problems with "quoting hell"....


-- 
Eugene
http://www.coxar.pwp.blueyonder.co.uk/


More information about the X-Unix mailing list