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: garbanzito <email@hidden>
- Date: Thu, 31 Jan 2002 23:17:16 -0700
at 2002 01 31, 17:55 -0500, they whom i call Oliver Sun wrote:
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?
[...]
If so, you will want to use single quotes, which are even stronger
than the double quote.
yes. i know too little about this. does the status of single
or double quotes change when the command line arguments
aren't passed by a shell? i guess if they're putting quoting
into the next release of AppleScript then the answer to that
will be intrinsic in how it's implemented (we hope).
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.
might it be better than "shell variable" to say "environment
variable", since "do shell script" doesn't invoke a shell?
i'm not even sure if environment variables are expanded in
command arguments if they're invoked by execv() (or whatever
Apple does in "do shell script" -- detailed docs would be
appreciated). in any case, don't expect .tcshrc or whatever
to have any effect on "do shell script".
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.
yeah, and should the single quote appear in a file name
(perhaps more common than double quote, since it's a
stand-in for apostrophe), you'd need to escape it too.
--
steve harley email@hidden