Files
mastering-unix-ss/chapter27/function_check_root_user
Fabio Scotto di Santolo 4cc88d2f6e initial commit
2020-07-28 19:28:25 +02:00

20 lines
448 B
Plaintext
Executable File

check_root_user ()
{
case $(uname) in
SunOS) if [[ $LOGNAME != root ]]
then
echo -e "\n\n\tERROR: Only the root User can Execute this Program..."
echo -e "\n\n\t...EXITING...\n"
exit 1
fi
;;
*) if [[ $(whoami) != root ]]
then
echo -e "\n\n\tERROR: Only the root User can Execute this Program..."
echo -e "\n\n\t...EXITING...\n"
exit 1
fi
esac
}