FreeKB - 0 Run a BASH script as root
Run a BASH script as root

The following markup in a BASH script can be used to ensure that the script is being run as root. Credit goes to this post on Ask Ubuntu for this markup.

if [[ $EUID -ne 0 ]]; 
   echo "This script must be run as root" 
   exit 1


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter e8389 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |