首页 > 代码库 > 常用bash,autoUserAdd.sh

常用bash,autoUserAdd.sh

#!/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/nullthen    echo $username is existfi read -p "please input the passward:" passward[ -z $passward ] && echo "a passward is needed" && exit 3 useradd $usernameecho "$passward" | passwd --stdin $username &> /dev/nullecho "add $username finished"

 

常用bash,autoUserAdd.sh