How do I create a keyboard shortcut to a script that needs sudo privileges? I tried to create shortcuts via Ubuntu Keyboard Settings GUI to scripts
"sh script.sh", "sudo sh script.sh"
, but they don't work.
|
How do I create a keyboard shortcut to a script that needs sudo privileges? I tried to create shortcuts via Ubuntu Keyboard Settings GUI to scripts
, but they don't work. |
|||
|
Put the sudo commands in the script on the lines you need privileges to run. Then run normally. |
|||||||||
|
|
sudo requires a terminal to get the password from. Use gksudo instead; it asks for the password via a gui dialog box.
|
|||
|
|
bashif it uses the extended functionalitybashprovides. When a script has a.shextension, that indicates (by convention) that it can be run by the system's defaultsh, even if that is notbash. (Most scripts with no extension can be run byshtoo--if a script needsbash, then its documentation should indicate this, or it should have a hashbang line at the top for it, which if you're manually invokingshorbashyou can check first.) – Eliah Kagan Jun 3 '12 at 17:02