I am running my manual backups with a shell script that asks me for a password. However, when I open the script from the Finder, it terminates immediately.
How can I get a script to run interactively when double clicking on it in Finder?
bashfinderterminal
I am running my manual backups with a shell script that asks me for a password. However, when I open the script from the Finder, it terminates immediately.
How can I get a script to run interactively when double clicking on it in Finder?
Best Answer
For a bash script to work from finder, it has to have the
.command
extensionFor example, I created the following script to use
sudo
to ask for a password and then to output a welcome message, then "wait" to simulate execution time:I saved it as
test.command
. You also have to make it executable:chmod +x test.command
Here's the result of clicking on the script: