to procCommand(commandToProcess)
try
with timeout of 1800 seconds
do shell script commandToProcess
end timeout
on error
log: "Command Not Processed: " & commandToProcess
end try
end procCommand[/code]
Can anyone explain why the line works in the terminal but does not work in applescript?
I cannot seem to get the exclude command for tar to work at all within applescript.
the problem is the wildcard (*) within the quotation. You can either put the wildcard after the double quote
or in this case I recommend to escape the spaces traditionally with a backslash
set commandToProcess to "gnutar cvf /Volumes/Cold_Storage_5/144000-144999/144073.tar /Volumes/COLD\\ STORAGE/144000-144999/144073 --exclude=/Volumes/COLD\\ STORAGE/144000-144999/144073/print\\ drive/*"
.
Note: the timeout block doesn’t affect shell scripts
set commandToProcess to "gnutar cvf \"/Volumes/Cold_Storage_5/144000-144999/144073.tar\" \"/Volumes/COLD STORAGE/144000-144999/144073\" --exclude=\"/Volumes/COLD STORAGE/144000-144999/144073/print drive/*\"
tell applcation "Terminal"
activate
do script commandToProcess
end tell
and it works. the only problem is using this method the script doesn’t wait for the tar command to finish before moving on.
it has to be something with the way the do shell script command parses everything after the – in the line.
is there anyway of “escaping” the – or maybe I can push them as ASCII instead.