Skip to content

Instantly share code, notes, and snippets.

@naps62
Last active May 12, 2024 08:23
Show Gist options
  • Save naps62/e44ec8ec9f831d9b83852b866d503599 to your computer and use it in GitHub Desktop.
Save naps62/e44ec8ec9f831d9b83852b866d503599 to your computer and use it in GitHub Desktop.
#!/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