首页 > 代码库 > 重复输出用户脚本

重复输出用户脚本

#!/bin/bash
Check_user()
{
UserName=$1
AllUsers=$(cat /etc/passwd | awk -F: ‘{print $1}‘)
for i in $AllUsers
do
if [ "$i" = "$UserName" ];then
return 1
else
continue
fi
done
return 0
}

Main()
{
for i in $@
do
if `Check_user $i`;then
useradd $i
echo "$i create ok"
else
echo "$i is already exsists"
fi
done
}

Main $*;

重复输出用户脚本