====== BASH - Check Whether You’re Root ====== #!/bin/bash ROOT_UID=0 if [ "$UID" -eq "$ROOT_UID" ] then echo "You are root." else echo "You are not root" fi exit 0 The output of this script depends on the user running it. It will match the root user based on the $UID.