Re: Scripting Additions: Embracing the Horror of Unix
Re: Scripting Additions: Embracing the Horror of Unix
- Subject: Re: Scripting Additions: Embracing the Horror of Unix
- From: Oliver Sun <email@hidden>
- Date: Thu, 31 Jan 2002 17:55:35 -0500
Date: Thu, 31 Jan 2002 14:02:32 -0700
From: garbanzito <email@hidden>
Subject: Re: Scripting Additions: Embracing the Horror of Unix
at 2002 01 30, 16:58 -0500, they whom i call J.B. Stewart wrote:
While I was writing this I discovered that the "POSIX path" property
(of
POSIX File) from Standard Additions (AS 1.8.2b1) didn't handle spaces
in
file names so there is a handler at the end of the script to "escape"
spaces in the path name.
"posix path" doesn't escape anything. if you only escape
spaces, you won't have covered all the possibilities
(quotes, angle brackets, etc.) i thought someone had built a
handler to escape everything needed, but i can't find it
offhand. an alternative is to quote every filename and path,
but you'd still have to escape quotes in the filename.
Am I understanding you correctly that you are trying to pass a string
from AppleScript to a shell script, which may possibly have spaces or
other special characters?
Example: "My HD:Users:Me:Documents:My Funny Stuff:WTF$CK" in the
traditional Mac form needs to become the POSIX path
/Users/Me/Documents/My Funny Stuff/WTF$CK, except you must deal with the
spaces and the $ ?
If so, you will want to use single quotes, which are even stronger than
the double quote. In this special case, double quotes will allow the $CK
will be interpreted as "the value of the shell variable CK," which may
or may not be defined and almost certainly isn't what you want.
Single quotes '/Users/Me/Documents/My Funny Stuff/WTF$CK' will literally
quote all that. In fact, you can quote double quotes within single
quotes in the shell. You will, of course, have to deal with the problem
that the double quote itself needs to be escaped or otherwise handled in
AppleScript.
Hope this was even remotely relevant. Anyway, if you just want to copy
some stuff using the BSD layer, "CpMac" from the Developer Tools (as
mentioned by some other posters) is the right way to go.
Cheers,
Oliver M. Sun
Indiana University/UITS