#!/bin/bash
read -rep $'Please enter username\n' username
#echo "you have entered $username"
if [ `grep -c $username /etc/passwd` -eq 0 ]
then
echo "$username is invalid"
else
echo "$username is valid"
fi
Showing posts with label Check if an username is present in /etc/passwd using shell script. Show all posts
Showing posts with label Check if an username is present in /etc/passwd using shell script. Show all posts
Thursday, November 24, 2022
Check if an username is present in /etc/passwd using shell script
Subscribe to:
Posts (Atom)