Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to check bash runs with sudo

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

#Note:
If you get 2: [: Illegal number: check if you have #!/bin/sh at the top
and change it to #!/bin/bash.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #bash #runs #sudo
ADD COMMENT
Topic
Name
9+4 =