Skip to content

Instantly share code, notes, and snippets.

@danog
Created April 14, 2015 20:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danog/13efaefe2aec27f447c5 to your computer and use it in GitHub Desktop.
Save danog/13efaefe2aec27f447c5 to your computer and use it in GitHub Desktop.
Automatic sudo request
#!/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