bash 需root运行
#!/bin/bash
ROOT_UID=0
E_WRONG_USER=65
if [ "$UID" -ne "$ROOT_UID" ]
then
echo;echo "You must be root to run this script.";echo
exit $E_WRONG_USER
fi
ROOT_UID=0
E_WRONG_USER=65
if [ "$UID" -ne "$ROOT_UID" ]
then
echo;echo "You must be root to run this script.";echo
exit $E_WRONG_USER
fi
ROOTUSER_NAME=root
username=`id -nu`
if [ "$username" != "$ROOTUSER_NAME" ]
then
echo *************************
exit 66
fi