Strange problem with quotes running away and hiding!
Strange problem with quotes running away and hiding!
- Subject: Strange problem with quotes running away and hiding!
- From: "Steven D. Majewski" <email@hidden>
- Date: Mon, 30 Jun 2003 18:19:13 -0400
I'm using the following handler to identify image files and distinguish
TIFFs, JPEGs, etc.:
on unixfiletype(pathname)
if pathname contains ":" then set pathname to POSIX path of pathname
set res to do shell script "file " & (quoted form of pathname)
return first word in text (offset of ":" in res) thru (length of res)
of res
end unixfiletype
It's been working without problem in my app for a week or more.
Recently, I made changes to the app somewhere else in the script.
I now get an error:
tell current application
do shell script "file '/Users/sdm7g/Desktop/SeqTst/1_1' "
"sh: -c: line 1: unexpected EOF while looking for matching `''
sh: -c: line 2: syntax error: unexpected end of file"
If I cut the "do shell script" line, as it appears in the log listing
above,
and paste it into a new script window, it appears without the trailing
single quote (')
just before the final double quote (").
If I click the run button and execute it as is, I get the same error
code, but this
time the log window does not show the single quote:
tell current application
do shell script "file '/Users/sdm7g/Desktop/SeqTst/1_1"
"sh: -c: line 1: unexpected EOF while looking for matching `''
sh: -c: line 2: syntax error: unexpected end of file"
If I fix up the line and insert the missing single quote, it does
execute without error.
-- Steve Majewski
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.