tell application "System Events"
set pid to unix id of the first process whose frontmost is true
end tell
do shell script "sed -e \"s/Safari/" & pid & "/\" /tmp/gdbtemp.txt > /tmp/gdbtemp2.txt"
do shell script "/usr/local/bin/gdb -n -command=/tmp/gdbtemp2.txt" with administrator privileges
But in the end,I still have this animated cog running endlessly.
I have tried on 2 computers, so there is definitely something I am doing wrong here...