创建用户usercreate.sh脚本
#!/bin/bash
#首先判断变量参数是否符合要求
if [ $# -lt 1 ];then
echo "Usage: ./usercreate.sh username"
exit 1
fi
#正题
username=$1
useradd $username
id $username
grep "$username" /etc/passwd
#!/bin/bash
#首先判断变量参数是否符合要求
if [ $# -lt 1 ];then
echo "Usage: ./usercreate.sh username"
exit 1
fi
#正题
username=$1
useradd $username
id $username
grep "$username" /etc/passwd