The following code is an example of what I'm using at the moment, but it keeps erroring out on me:
do shell script "find /Applications -name 'Bingo.app' > /tmp/remove_files" with administrator privileges
if exists "/tmp_malware_alternate" then
do shell script ("for i in `cat /tmp/remove_files`; do rm -rf $i") with administrator privileges
do shell script "rm -rf /tmp/remove_files" with administrator privileges
end if
It's supposed to find the existence of a file (in this case, Bingo.app
) and write it to a temporary file (/tmp/remove_files), which it does, and then check to see if the temporary file was written. If it was, it will look into that temporary file, and delete each file (specified by i
) in the temporary file listing, then remove the temporary file itself.
Instead, all it ever does is return an error:
/bin/sh: -c: line 1: syntax error: unexpected end of file
or
error "/bin/sh: -c: line 1: syntax error: unexpected end of file" number 2
What am I missing in this?
Best Answer
You need to close the
for
loop:should be: