#/bin/bash
echo "enter username to check"
read username
match=0
for line in `cat /etc/passwd`
do
if test `echo $line | cut -d ":" -f 1| cut -d "," -f 1` == $username ;
then
#match=$(($match+1))
#let "match=match+1"
#let "match++"
((match++))
fi
done
if [ $match -gt 0 ];
then
echo "$username is valid because match is $match"
else
echo "$username is not valid because match is $match"
fi
No comments:
Post a Comment