首页 > 其他 > 详细

常用bash,autoUserAdd.sh

时间:2017-02-26 23:47:40      阅读:224      评论:0      收藏:0      [点我收藏+]
#!/bin/bash
# auth: xiluhua
# date: 2017-02-26
 
read -p "please input a username:" username
[ -z $username ] && echo "a username is needed" && exit 2
 
if id $username &> /dev/null
then
    echo $username is exist
fi
 
read -p "please input the passward:" passward
[ -z $passward ] && echo "a passward is needed" && exit 3
 
useradd $username
echo "$passward" | passwd --stdin $username &> /dev/null
echo "add $username finished"

 

常用bash,autoUserAdd.sh

原文:http://www.cnblogs.com/xiluhua/p/6456120.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!