help me do a small program!! THX

Write a shell script (to run on the Bourne shell) that runs an infinite loop to check every 5 seconds to report on who logs into and who logs out of a UNIX system. Without loss of practical significance of this little utility, we can ignore multiple logins from the same user during a time period of less than 5 seconds.

You would need to research these UNIX commands: cut, sort, cmp.

Your script for this task must be named log.sh. The following is a sample output of the script (It is OK that the script leaves behind a temporary file when it is finally interrupted). The $ is the shell prompt.

$ log.sh
The current users are:
abc1
rv0
sxu
tgray

No user has logged in/out in the last 5 seconds.

No user has logged in/out in the last 5 seconds.

User rsmith has logged in.

No user has logged in/out in the last 5 seconds.

User abc1 has logged out.

No user has logged in/out in the last 5 seconds.
... ... ... ... ... ... ... ...

No homework/classroom problems allowed. Thread closed.