Skip to content

Instantly share code, notes, and snippets.

@dserodio
Last active November 29, 2018 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dserodio/24be483225d9be3e7b2664dd7de47702 to your computer and use it in GitHub Desktop.
Save dserodio/24be483225d9be3e7b2664dd7de47702 to your computer and use it in GitHub Desktop.
Ensure that a script is executed as root
#!/bin/bash
if [[ "$(id -u)" -ne 0 ]]; then
sudo "$0" "$@"
exit $?
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment