Script to force quit all open applications not working get syntax error
If I put the following in Terminal
kill $(osascript -e 'tell app "System Events" to unix id of processes where background only is false'|tr -d ,)
it kills every running process.
If I put it in an Apple script, it does not work.
Example:
tell application "Terminal"
do script "kill $(osascript -e 'tell app "System Events" to unix id of processes where background only is false'|tr -d ,)"
end tell
or
do shell script "kill $(osascript -e 'tell app "System Events" to unix id of processes where background only is false'|tr -d ,)"
I get an syntax error stating: A identifier can’t go after this “"”.
Flagging "System.
What do I do wrong?
MacBook Pro 15″, macOS 10.13