#1 这个比较麻烦一点 id | grep "uid=0(" >/dev/null if [ $? != "0" ]; then uname -a | grep -i CYGWIN >/dev/null if [ $? != "0" ]; then echo "ERROR: The Webmin install script must be run as root" echo "" exit 1 fi fi #2 相对简单快捷一些 if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use root to run this script" exit 1 fi //shell/1265