Calendar
<<  < 2009 - 12 >  >>
12
3456789
10111213141516
17181920212223
24252627282930
31
Placard
Category
Latest Entries
Latest Comments
Last Messages
User Login
    
 用户注册 忘记密码
Links
Information
  • 日志:153
  • 评论:14
  • 留言:0
  • 访问:78303
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
====================================
在输入上没有过滤.......我想.....如果是管理人员使用的话,应该不成问题的.
[ 阅读全文(144) | 回复(0) | 引用通告(0) | 编辑

  Post  by  badboy 发表于 2006-12-23 11:31:00
发表评论:
粗体 斜体 下划线 插入引用 插入表情
坏男孩