View Full Version : Bash .command script - Prompt for sudo password in Finder?
BrianFD3S
Dec 10, 2008, 06:22 PM
Hi all. I'm writing a bash script that I'm saving as a .command file so it can be executed through the Finder. However, it involves some commands that need sudo privileges, and rather than have the person using it have to enter their password in "scary Terminal", I would like Finder to prompt them to enter their sudo password. Is this possible?
Thanks
Baron58
Dec 10, 2008, 06:36 PM
Hi all. I'm writing a bash script that I'm saving as a .command file so it can be executed through the Finder. However, it involves some commands that need sudo privileges, and rather than have the person using it have to enter their password in "scary Terminal", I would like Finder to prompt them to enter their sudo password. Is this possible?
Thanks
You can use osascript -e to run an applescript command to throw up a GUI dialogue. Set the result of that dialog as a variable, then use that variable in an 'expect' script within your shellscript to do the sudo'ing.
BrianFD3S
Dec 11, 2008, 02:41 AM
Hmm, ok thanks. Also, it seems that .command files must be chmod +x/755'd before you can run them.. this file is going to be uploaded and the whole point is so people don't have to to interact with the terminal :/
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.