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

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -