【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
learning shell check requires root privileges
原文:https://www.cnblogs.com/lianghong881018/p/12058892.html