#!/bin/bash
#AUtor : gaohuina
#date: 2011-01-05
#DESC :
if   [ $USER=root ];then
read -p "please input the username:" MYUSER
read -p "please input the common:" MYCOMMON
  if cut -d: -f1 /etc/passwd | grep "^$MYUSER" &> /dev/null; then
  MYCOMMON1=echo "`which $MYCOMMON`" && echo "$MYCOMMON1"
   $MYUSER 192.168.0.0\/24=\(root\) $MYCOMMON1 >> /etc/sudoers
   su - $MYUSER
  sudo $MYCOMMON1
   fi
else
exit 3
fi

执行不出来 只能切换用户 $MYUSER 192.168.0.0\/24=\(root\) $MYCOMMON1 >> /etc/sudoers 不能执行