Created
November 6, 2019 11:22
-
-
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
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
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