Shell command help

Hi to you all

I am fairly new to unix and a very green programmer.

Just to avoid some harsh responses as i saw in other posts: THIS ISNOT A QUESTION RELATED TO AN ASSIGNMENT OR CONTRACT" if i wanted to get something done for me, I would use my Rent A Coder or E Lance accounts. I am trying to learn how to do a few scripts in order to better understand server errors for networking.

So here is a question:

How can i determine in UNIX the amount of UNIQUE users logged in at a given time. I searched "Display unique users" and " WHO command options" and consulted man who and who info for details to no avail.

I just want to know how to display the UNIQUE number of users loged on to the shell so that my script will display either the total or unique users loged in.
I already figured out how to display the total ammount of users.

Thanks in advance

Greg

The 'who' command will report all logins. Pipe it through 'sort', then do a bit of homework: type 'man sed' and see how to condense that output to unique users.

$ who | ruby -ane 'BEGIN{a=[]};a<<$F[0];END{p a.uniq}'
who | cut -d' ' -f1 | sort +1 | uniq

Thanks for the input!!

Wasnt it easier to send a post about your server's network errors?

Hi VBE,

The point here is not to solve an existing issue but rather to comprehend them as they happen. I am diving into UNIX without any prior programming knowledge and everyone says that knowing how to script is key, so hence the question. Also, as I mentioned in the original post, if I want to get answers or solutions without understanding, or making an attempt to od so, I will contract a coder on ELance or VWorker, etc...

Thanks for the thought though!

Cheers

Greg

For the unique number of users, surely we need to count them:

who -u | awk '{print $1}' | sort | uniq | wc -l