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?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
For a bash script to work from finder, it has to have the
For 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:
#!/bin/bash sudo echo "Welcome to Ask Different" sleep 10 exit 0
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: