On Dec 09, 2015, at 12:16, Yvan KOENIG <
email@hidden> wrote:
I will probably add the quoteIt handler in all my scripts supposed to build POSIX paths. I will just change its name to highlight the fact that what is important is not quote but POSIX.
______________________________________________________________________
Gotcha.
One thing I always do when assembling do shell script code is to create the command in text before running it from the text variable.
set shCMD to "echo \"I'm a command\""
do shell script shCMD
With all the quoting and such it can be very hard to read the code, and this method greatly facilitates debugging.
-------------------------------------------------------------------------------------------
set shCMD to "echo \"I'm a command\"!"
# DEBUG
bbeditNewDoc(shCMD, true)
return
do shell script shCMD
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on bbeditNewDoc(_text, _activate)
tell application "BBEdit"
set newDoc to make new document with properties {text:_text, bounds:{0, 44, 1920, 1200}}
tell newDoc
select insertion point before its text
end tell
if _activate = true or _activate = 1 or _activate = "activate" then activate
end tell
end bbeditNewDoc
-------------------------------------------------------------------------------------------
Not only is it easier to eyeball this way, but from BBEdit (or TextWrangler) I can plop in a shebang line and run it to make certain it's working properly.