Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2012 02:32
Show Gist options
  • Save anonymous/3850424 to your computer and use it in GitHub Desktop.
Save anonymous/3850424 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