Created
February 4, 2021 16:14
-
-
Save flickerfly/472c2776d5507767ca4e35ecb44aac6e to your computer and use it in GitHub Desktop.
Check if user is not root
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
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
read -p "Disregard and continue anyway? (y/n): " -r response | |
if [[ $response != "y" ]]; then | |
echo "WARNING: Aborted due to response $response" | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment