码迷,mamicode.com
首页 > 系统相关 > 详细

svn添加用户shell

时间:2017-03-08 10:42:26      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:shell   sed   pre   cas   ase   name   ash   add   more   

#!/bin/bash
adduser(){
                echo "Copy authz File authz to `date  "+%Y%m%d%s"`"&&cp authz authz`date  "+%Y%m%d%s"`
#               more authz | grep ^[A-Z] | grep $DP | sed ‘s/$/&,‘$USER‘/g‘ > authz.new
                sed -i ‘/^‘$DP‘/s/$/,‘$USER‘/‘ authz
}
process(){
if [ "$DP" != "" ]
then
        for i in `more authz  | grep "$DP =" | grep -v @ | awk ‘{print $3}‘ | tr "," "\n"`
        do
                more passwd | grep $i > /dev/null 2>&1
                if [ $? = 1 ];
                then
                        echo "Copy passwd File to passwd`date  "+%Y%m%d%s"`"&&cp passwd passwd`date  "+%Y%m%d%s"`
                        sed -i ‘/‘$DP‘/a\‘$i‘ = ‘$i‘@emoney‘ passwd
                        more passwd | grep $i > /dev/null 2>&1
                        if [ $? = 0 ];
                        then
                                echo "User $i Add Succes"
                        else
                                echo "User $i Add Flase"
                        fi
                fi
        done
else
        echo "Department ID not set"
fi
}


read -p "Please Input New UserName:" USER
read -p "Please Input Department ID:" DP
case $DP in
Market_SEM)
        adduser
        sleep 1
        process
;;
Market_UE)
        adduser
        sleep 1
        process
;;
JSB_JG)
        adduser
        sleep 1
        process
;;
JSB_OP)
        adduser
        sleep 1
        process
;;
Market_PD)
        adduser
        sleep 1
        process
;;
Market_mk2)
        adduser
        sleep 1
        process
;;
Market_PR)
        adduser
        sleep 1
        process
;;
*)
        if [ "$DP" = "" ]
        then
                echo    "Department ID not set"
        else
                echo -e "Department Mistake\n#####Detail List######\nMarket_SEM\nMarket_UE\nJSB_JG\nJSB_OP\nMarket_PD\nMar
ket_mk2\nMarket_PR\n#####Detail List######"
        fi
;;
esac

  

svn添加用户shell

标签:shell   sed   pre   cas   ase   name   ash   add   more   

原文地址:http://www.cnblogs.com/beckham-7/p/6517986.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!