improve check if we are root already - in scripts/get

$EUID is readonly, so it should be save to test against it.

Thanks for the tip @thomastaylor312 !
This commit is contained in:
Tony Fahrion 2017-06-29 13:22:08 +02:00
parent 974c4b67c7
commit 8eace382f9

View file

@ -50,7 +50,7 @@ initOS() {
runAsRoot() {
local CMD="$*"
if ! whoami | egrep -q '^root$'; then
if [ $EUID -ne 0 ]; then
CMD="sudo $CMD"
fi