Skip to content

Instantly share code, notes, and snippets.

@holys
Forked from anonymous/logon.sh.txt
Created October 8, 2012 02:35
Show Gist options
  • Save holys/3850426 to your computer and use it in GitHub Desktop.
Save holys/3850426 to your computer and use it in GitHub Desktop.
logon.sh
#!/bin/sh
# Judge a user is logged on or not
#
user="$1"
if who | grep -w "$user">/dev/null
then
echo "$user is logged on "
else
echo "$user is NOT logged on"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment