Last active
May 12, 2024 08:23
-
-
Save naps62/e44ec8ec9f831d9b83852b866d503599 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
function check_root() { | |
id -u | |
ps -o comm= -p $PPID | |
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then | |
echo -e "\nExiting..." | |
exit | |
fi | |
} | |
echo "asd" | |
check_root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment