Skip to content

Instantly share code, notes, and snippets.

@varvaruc
Created December 10, 2019 13:29
Show Gist options
  • Save varvaruc/46e1f964a89cead5d1069703e7d4e7d8 to your computer and use it in GitHub Desktop.
Save varvaruc/46e1f964a89cead5d1069703e7d4e7d8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Display exit status of the command:
# echo $?
echo -n "Enter user name : "
read USR
cut -d: -f1 /etc/passwd | grep "$USR" > /dev/null
OUT=$?
if [ $OUT -eq 0 ];then
echo "User account found!"
else
echo "User account does not exists in /etc/passwd file!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment