Check if script is run as root user

child theme

#Check if script is run as root user

#! /bin/bash

echo $EUID

if [[ $EUID -eq 0 ]]
then
echo "You are root user";
else
echo "You are not root user";
fi

$ whoami

whoami will give the name of the current user