1
I am taking my first Linux class and we are writing scripts. Currently I'm trying to write a script that will look at who is online and then send them a mail
This is an entry level linux class so nothing to crazy, and I'm an Old man taking this class. I haven't used computers since I had my TRS-80 and learned basic.
What I'm wondering is how I store user names in some sort of array or variable. I think I need to start with a variable counting the users like
NUMUSERS=users | wc -w
and then I think I need to use that info to create a variable that will grep all the names.
USERNAME=`who | awk '{print $1}' | sort | uniq
this works if only one person is online. But I'm not sure how/what to write if more people get on.
Any help?
And if you really need to count them, just drop a
x=0
at the beginning and a(( x += 1 ))
in the while-do loop. – bgStack15 – 2014-07-14T11:54:17.280