ACCEPT
USERNAME AS COMMAND LINE ARGUMENTS AND
CHECK THE USER LOGIN IN OR NOT
echo "To
check the user login or not"
if [ $# -eq 1 ]
then
who > y.txt
c=`grep -n $1 y.txt | wc -l`
fi
if [ $c -gt 0 ]
then
echo "The user has login"
else
echo "The user has not login"
fi
OUTPUT:
[@localhost ~]$ sh acceptlogin.sh
2k7ca320
To check the user login or not
The user has login
[@localhost ~]$ sh acceptlogin.sh
2k7ca337
To check the user login or not
The user has not login
[@localhost ~]$
No comments:
Post a Comment
Thanks for your valuable comments