Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BrianFD3S

macrumors member
Original poster
Feb 19, 2008
71
0
Ireland
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

macrumors 6502
Feb 19, 2004
450
3
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

macrumors member
Original poster
Feb 19, 2008
71
0
Ireland
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 :/
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.