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


ROOTUSER_NAME=root

username=`id -nu`

 if [ "$username" != "$ROOTUSER_NAME" ]

then

echo *************************

exit 66

fi

 

posted @ 2010-06-01 14:10  waynechen  阅读(335)  评论(0编辑  收藏  举报