hi all.
Is there any way to get the original names (not the login names) of users currently logged on to the machine and the processes they are logged on to...names as in abc xyz and not abc.xyz
I dont want to first use w -s and then loops to arrange the information, and i cant figure out how to use grep and then display the users.
$ w -s, $ users, $ ps commands can not be used in the best of knowledge. Is there any other way..
w -s | awk 'BEGIN { getline; getline } {print $0}' | cut -c1-8,16-
You may need to alter the "16" to another number to get exactly what you want.
Your output of w -s may vary from mine.
Thank You jim, but the output is still exactly the same as w -s on my system. I cant figure out why...
Basically what I'm trying to do is first read the logged on users using the 'users' command, save it in a varible and then running a while loop to get the processes according to the logged on users.
i.e.
#!bin/bash
var=$(users);
or something like
while read $(users)
do
w $user
done
but its giving me an 'invalid identifier' error
should i be using 'case' for this.