A useful bash shell script that will only run a command as the root user.

This is a shell script that will only run if the user executes it as the root user. I got this tip here: http://www.cyberciti.biz/tips/shell-root-user-check-script.html. #!/bin/bash     CMDROOT="yum update"   if [[ $EUID -ne 0 ]]; then echo echo "You must be a root user to run this command." 2>&1 exit 1 else echo echo … Read more