Calendar
数据载入中,请稍候......
Placard
数据载入中,请稍候......
Category
数据载入中,请稍候......
Latest Entries
数据载入中,请稍候......
Latest Comments
数据载入中,请稍候......
Last Messages
数据载入中,请稍候......
User Login
数据载入中,请稍候......
Links
Information
数据载入中,请稍候......
Search
Other


Welcome to my blog!
  批量添加用户
 
#!/bin/bash
# Auto add user program
#Author HaHaZhu 12/23/06
Loop=0
echo -n "Please Input total users:"
read Total
echo -n "Please Input user name:"
read user
echo -n "Please Input User password:"
read password
echo -e "Format:User:$user$Loop\tPassword:$password"
echo "waiting...."
sleep 2
tput clear
echo "Are you sure?[y|n]"
read ANS
case $ANS in
 y|Y)
    while [ $Loop -lt $Total ]
    do
    adduser $user$Loop
    echo "$password"|passwd $user$Loop --stdin >/dev/null
    if [ $? = 0 ];then
      echo "$user$Loop ok!"
    else
      echo "$user$Loop fail!"
    fi
    Loop=`expr "$Loop" + 1`
    done
    ;;
  n|N)
     ;;
esac
====================================
在输入上没有过滤.......我想.....如果是管理人员使用的话,应该不成问题的.
[ 阅读全文 | 回复(0) | 引用通告 | 编辑

  Post  by  badboy 发表于 2006-12-23 11:31:00
发表评论:
数据载入中,请稍候......
数据载入中,请稍候......