Skip to content

Instantly share code, notes, and snippets.

@danog
Created April 14, 2015 20:19
Show Gist options
  • 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