1.设计一个 shell 程序,添加一个新组为 class1,然后添加属于这个组的 30 个用户,用户名的形式为stuxx,其中 xx 从 01 到 30。
在/tmp目录下新建一个shell脚本std.sh
[root@localhost tmp]# vim std.sh
#!/bin/bash
#添加一个组class1
groupadd class1;
for((i=1;i<=30;i++))
do
if [ $i -lt 10 ]
then
username=stu0${i}
else
username=stu${i}
fi
useradd -g class