Home Linux Write a shell script to check whether the named user is currently logged in or not.

Write a shell script to check whether the named user is currently logged in or not.

38 second read
0
0
62

Write a shell script to check whether the named user is currently logged in or not.


echo "Please enter the name of the user:"

read user

who | grep $user>/tmp/usertest &

if [ -s/tmp/usertest ]

then

echo "User is logged in...."

else

echo "User is not logged in..."

fi

Load More Related Articles
Load More By coder coder
Load More In Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

Prime Or Not Prime vb.net Program.

Prime Or Not Prime . …