AppleScript Runner exit status passed back to shell script AppleScript Runner exit status passed back to shell script shell shell

AppleScript Runner exit status passed back to shell script


The -e flag prints errors to stderr and is the default. So you just need to read stderr.

This answer might help you if you aren't familiar with that:

bash variable capture stderr and stdout separately or get exit value

EDIT: Added sample code.

error=`osascript -e 'tell app "Finder" to adtivate' 2>&1`echo $error

The above on my system captures the error messages.