linux - Checking if root inside bash script -


I want to know whether the script is running or not before the user can run but it does not seem to work. Currently logged in as root, but I think there is something wrong with syntax.

  If [[EUID-0]]; Then echo "Sorry, you are not root." Exit 1 else echo "You are root, the script will continue." << code>   

You have a place between if and [.

Comments

Popular posts from this blog

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -