script check the users in SHELL every 1 minute ?

could you please find a solution for this:

I need to write a shell script which checks after every minute whether a friend has logged in or not.The script should report whether that person has logged in along with the amount of time the person was late in logging in.

I have no idea how to do this bcoz i'm really new to it,and it would be really nice if someone could help :slight_smile:

who | grep <friends name>

while(true)
do
who | grep <friends name>
sleep 60
done

Run this scrit in back groud. or u can set alert by sending the mail