• Source
    1. #
    2. # Write a shell script to check whether the named user is currently logged in or not.
    3. #
    4. clear
    5. echo -n "Enter name of the user :"
    6. read user
    7.  
    8. c=$(who | grep -ci $user)
    9. if [ $c -gt 0 ]
    10. then
    11. echo "User is logged in to the system"
    12. else
    13. echo "User is not logged in to the system"
    14. fi
    15.  
    16.