Skip to content

Instantly share code, notes, and snippets.

@flickerfly
Created February 4, 2021 16:14
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 flickerfly/472c2776d5507767ca4e35ecb44aac6e to your computer and use it in GitHub Desktop.
Save flickerfly/472c2776d5507767ca4e35ecb44aac6e to your computer and use it in GitHub Desktop.
Check if user is not root
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