Working on a user monitoring script!

Hello,

Good progress, well done ! One of the most commonly-used ways of selecting a particular field or portion of input for re-use elsewhere in a script is to use awk. That topic has been covered on this forum quite a bit, but here's a link to a recent thread that comes to mind where I gave someone an example of using awk in this way:

Transfer data from log file to excel

In your case, you'd want to pipe the output of who into awk rather than use awk to read its input from a file, but in all other respects this should do what you need.

Hope this helps ! Let us know how you get on, and if you have any more questions please feel free to ask.