Skip to content

Instantly share code, notes, and snippets.

@YordanGeorgiev
Created November 6, 2019 11:22
Show Gist options
  • Save YordanGeorgiev/107f1b5057b351e1c50ec94422b2a291 to your computer and use it in GitHub Desktop.
Save YordanGeorgiev/107f1b5057b351e1c50ec94422b2a291 to your computer and use it in GitHub Desktop.
[check that script is run under root or sudo] how-to check that script is run under root or sudo
do_chk_only_root_can_execute_me(){
if [[ $(id -u) -ne 0 ]]; then
echo "This script must be run ONLY as THE root"
exit 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment