learning shell check requires root privileges (9)

Purpose

       Shell script check requires root privileges

 

Eevironment

       Ubuntu 16.04 bash env

 

Procdeure

  Source code: 

#!/bin/bash
if [[ $EUID != 0 ]]; then
        echo "This script requires root privileges, trying to use sudo" 
        sudo "test.sh" "$@"
        exit $?
fi
原文地址:https://www.cnblogs.com/lianghong881018/p/12058892.html