#!/bin/sh
echo -n "enter you username :"
read name
if cat /etc/passwd | awk -F : ‘{print $1}‘ | grep $name >/dev/null 2>&1
then
echo "User already exists"
else
/usr/sbin/useradd $name
echo "Usersname have been added"
fi
时间: 2024-10-23 21:17:57