看到这个需求时,第一时间想到的2个关键字:用户组,用户
需要解决的问题
1.判断输入用户是否为空
2.两数之间怎么取出中间的数值,用什么方式?cat ?seq?
#! /bin/bash##add a new user group, and let all of new user join in.##written by zhdya_20171011read -p "pls input a user's group name, like msxf:" gread -p "pls input a number which from XX and end of XX, like 01 05, it will create msfinance01 ... msfinance05:" n mif [ -z $g ] && [ -z $n ] && [ -z $m ]then echo "pls it must input the PARA." exitfigroupadd $gecho "already created the usergroup $g"for i in `seq $n $m`do useradd msfinance$i -g $gdoneecho "already created the user you needs."
该脚本不是我写的哈, 看完之后,是不是明白了怎么操作呢?