Active Citizen
Active Citizen

Reputation: 107

Prevent a bash script from waiting for seperate Applescript to finish

I'm sorry if the title of my question is confusing. Basically, I have a bash script (.sh file) that opens an Applescript file when it is done. Once the Applescript is done, it's supposed to quit the terminal process that the bash script started. The applescript works great if I run it independently of the bash script, but the catch is when I open it with the bash script, it waits for the Applescript to be done executing, and thus, the terminal process asks me if to confirm the closing of the process. I want to avoid that message entirely and just quit (or maybe I have to force quit?) the process.

Here's my code:

do shell script "xattr -rd com.apple.quarantine ~/Downloads/Samantha-Installer.app"

tell application "Terminal"
    close (every window whose name contains "Pure")
    if (count of windows) is 0 then tell application "Terminal" to quit
end tell

Sorry if it's confusing!

Thanks

Upvotes: 0

Views: 513

Answers (1)

regulus6633
regulus6633

Reputation: 19032

I assume you launch yor applescript from your bask script using the osascript command. If so then just add "> /dev/null 2>&1 &" to the end of your osascript command. For example...

osacript path/to/applescript.scpt > /dev/null 2>&1 &

This basically means do not wait for any input from the applescript and coninue the bash script.

Upvotes: 4

Related Questions