内容发布更新时间 : 2025/5/23 16:36:48星期一 下面是文章的全部内容请认真阅读。
#用户组GID处理 gID=\
while [ -z $gID ] do
echo -n \用户组GID:\read gID; if [ -z $gID ] then
echo \错误!用户GID是不能为空的,请重新输入!\ continue; fi
if [ `expr match $gID \then
echo \错误!用户的GID必须为数字,请重新输入!\ gID=\ continue; fi
if [ $gID -lt 500 -o $gID -gt 60000 ] then
echo \错误!用户组的ID范围为500~60000,请重新输入!\ gID=\ continue; fi done
echo -n \说明:\#bash,sh,csh,ksh shellVersion=\
while [ -z $shellVersion ] do
echo -n \登录SHELL(bash,sh,csh,ksh):\ read shellVersion;
if [ $shellVersion != \$shellVersion != \ then
echo \输入的Shell类型【$shellVersion】不在本系统支持范围内,请重新输入!\
shellVersion=\ fi done
echo -n \用户工作目录:\mkdir /home/$userName; if [ $? -eq 0 ] then
echo $userName \成功创建!\fi
18
userInfo=\rsion\
echo $userInfo >> $dataSource; if [ $? -eq 0 ] then
echo \用户信息添加成功!\else
echo \用户信息添加失败!\fi
echo -n \是否继续添加其他用户??(y/n)\ read isContinue; done
#! /bin/bash
dataSource='passwd'; ../menu.sh; clear;
isContinue=%userName=\
while [ $isContinue = \do
while [ $isContinue = \ do
echo -n \输入用户名:\read userName;
if [ -z \then
(3)delete.sh文件
echo \用户名不能为空,请重新输入!\ isContinue=\ continue; fi
CheckDataSourceFileExist; if [ $? -ne 1 ] then
deleteUser=$(awk -F \'$1 == \{ print $0 }' $dataSource);
if [ $deleteUser ] then
echo \用