I want to know How to determine current users who are logged in using a specific domain?
For example, here is the question. Please tell according to it using the grep command and use of wc.
Question: Write a C shell script called
countkpuwhich determines how many of the currently logged in users are logged in from a computer on the kwantlen.ca domain.
To do this, note the
whocommand will show each user who is logged in along with identification of their computer.
You can feed this information to the
grepcommand, to only display strings that contain the "kwantlen.ca". You can then further feed this output to the
wccommand, which can be used in such a way to just count lines of output.
HERE IS WHAT I DID:
grep `hostname` /etc/hosts
10.65.36.35 gator gator.kwantlen.ca loghost
The Problem is how will I combine the
who command as in the question? I mean it is not telling who is logged in using this domain.