I want to create a script to check whether a user exists. I am using the logic below:
# getent passwd test > /dev/null 2&>1 # echo $? 0 # getent pa
I was using it in that way:
if [ $(getent passwd $user) ] ; then echo user $user exists else echo user $user doesn\'t exists fi