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

Posted on Jan 17, 2021 2:39 AM

Reply

Similar questions

4 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Script to force quit all open applications not working get syntax error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.