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

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -