Friday, 12 December 2014

Shell Script to see if a user is already exists

Write a Shell Script to see if a user is already exists

Solution:

echo "Enter The User Name"
read userid
if grep "^$userid:" /etc/passwd > /dev/null
then
echo "$userid already exists"
else
echo “The user is not exist”
exit
fi

Execution:

No comments:

Post a Comment