#!/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
本文转自 yuri_cto 51CTO博客,原文链接:http://blog.51cto.com/laobaiv1/1839593,如需转载请自行联系原作者