Last active
December 16, 2016 17:40
-
-
Save brianoflan/d6a76cfb742ce0dd66b8df7909b47bf3 to your computer and use it in GitHub Desktop.
Fail unless run by root (id, forceRoot, exit)
This file contains hidden or 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 | |
forceRoot() { | |
[[ "$(id -u)" == "0" ]] || { echo "ERROR: Must run $0 as root." ; exit 1 ; } | |
} | |
forceRoot ; | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment