#!/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 [email protected]
do
if `Check_user $i`;then
useradd $i
echo "$i create ok"
else
echo "$i is already exsists"
fi
done
}
Main $*;
时间: 2024-10-10 22:45:42