#!/bin/bash user=`who | cut -f1 -d ' '| uniq` for name in $user do if [ $name = 'tom' ] then echo "tom is online" fi done