Tuesday, August 11, 2015

Check Root User



#--------------------------
#   c h e c k _ r o o t
#--------------------------
# Checks that the current user is "root" else exit.

check_root()
{
   if [ "$(/usr/ucb/whoami)" != "root" ]; then
      echo "\007You must be root to run this script!"
      exit 1
   fi
}

No comments:

Post a Comment