Keep standalone bash script app open after run of script
I have a bash script that I have turned into a standalone macOS app (i.e. I created a folder Script.app
which contains subfolders Contents
and MacOS
and in the folder MacOS resides my bash script). If I open the app the bash script runs and after the successful run, the app closes immediately.
I would like the app to remain open and run another bash script upon quitting the app. Or, if this cannot be done, perform some Finder action upon quitting (more precisely unmounting a Volume).
Solution 1:
Gathering what's above in the comments, here's what works: Use Script Editor to write a script containing
do shell script "complete_path_to_start_script"
on quit
do shell script "complete_path_to_quit_script"
continue quit
end quit
Use Script Editor to export the script as a standalone app which remains open after the start script has terminated. This option can be selected in a checkbox.