1#!/bin/sh 2 3# 0 - user was found 4# 1 - wrong argument 5# 2 - user not found 6 7if test "$#" -eq 1 8then 9 if who -a | tr -s ' ' | cut -d ' ' -f 1 | grep "^$1$" > /dev/null 10 then 11 echo "User $1 is logged-in." 12 else 13 echo "User $1 is not logged-in." 14 exit 2 15 fi 16else 17 echo "Usage: $0 <user>" 18 exit 1 19fi 20 21