1.  #!/bin/bash 
  2.  
  3. #create users and quota for /home patition 
  4. #批量创建用户并分配磁盘配额 
  5. #2012-10-15 v1 
  6.  
  7. if [ ! $(grep quotagrp /etc/group) ];then 
  8.         groupadd quotagrp 
  9.         echo "quotagrp created." 
  10. else 
  11.         echo "quotagrp exist." 
  12. fi 
  13.  
  14. declare -i n; 
  15.  
  16. for((n=6;n<=10;n=$n+1)) 
  17. do 
  18.         useradd -g quotagrp user$n 
  19.         echo "user$n" | passwd --stdin user$n 
  20.         setquota -u user$n 50000 60000 0 0 /home 
  21. done