Mac – How to run a bash script outside of a terminal

bashmacsayscriptterminal

Hey All, wrote this script to confuse my girlfriend when she is using my computer. The only trouble is that if the terminal gets closed the script stops to execute. It currently executes in the background but how can I make it run in the background but not in a terminal?

(sleep 5; say "Hello Girlfriend")&

Best Answer

You could schedule it to run at a specific time with at or cron in the background.