Created
April 14, 2015 20:19
-
-
Save danog/13efaefe2aec27f447c5 to your computer and use it in GitHub Desktop.
Automatic sudo request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Automatic sudo request | |
if [ $(id -u) -ne 0 ]; then | |
sudo $0 $* || echo "I am not sudo." | |
exit $? | |
fi | |
echo "I am sudo." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment