面试题答案
一键面试#!/bin/bash
read -p "请输入用户名: " username
if [[ $username =~ ^[a-zA-Z0-9]{3,15}$ ]]; then
useradd $username
else
echo "用户名必须只包含字母和数字,且长度在3到15个字符之间"
exit 1
fi
#!/bin/bash
read -p "请输入用户名: " username
if [[ $username =~ ^[a-zA-Z0-9]{3,15}$ ]]; then
useradd $username
else
echo "用户名必须只包含字母和数字,且长度在3到15个字符之间"
exit 1
fi