1834018 Members
2081 Online
110063 Solutions
New Discussion

who -um command help

 
SOLVED
Go to solution
Kris_5
Occasional Advisor

who -um command help

Hi All,

I am trying to set DISPLAY for my session using the following command.
setenv DISPLAY `who -um |awk '{print $8}'
Some reason, this command fails with the error
`who -um |awk '{print $8}'`:0.0: Ambiguous.

I checked the command who -um and I am getting more than one record. Interesting part is I logged in as opapps, but it also returns acsXX sessions too.

acsqa pts/tC Feb 16 02:25 . 6782 ???.???.???.???
acsqa pts/tC Feb 16 07:25 . 13056 xxxxx.xxx.xxxx.com
acs pts/tC Jan 18 11:30 . 25693 xxxxx.xxx.xxxx.com
opapps pts/tC Feb 16 20:34 . 11517 xxxxx.xxx.xxx.com

Can some body explain me why? TIA
4 REPLIES 4
Patrick Wallek
Honored Contributor

Re: who -um command help

The problem is that there are apparently several different users connected to the same pts port. Since all are using pts/tC, you'll get the info for all 4 users.

You might try a:

who am i -um

(Note that there are spaces in the above command.) I don't know if that'll behave any better for you or not.
Biswajit Tripathy
Honored Contributor
Solution

Re: who -um command help

Another way to set the display would be:

whoami=`who -R am i`
display=${whoami##*\(}
display=${display%\)}
export DISPLAY=$display:0.0

- Biswajit
:-)
Peter Godron
Honored Contributor

Re: who -um command help

Kris,
we use:
export DISPLAY=`who -Rm|cut -f2 -d"("|cut -f1 -d")"`:0.0;

Does this work for you?
Gordon  Morrison
Trusted Contributor

Re: who -um command help

I also get multiple lines for all of the suggestions above.
Looks like you'll just have to grep for what you want, and possibly also grep -v what you don't want.
e.g.
export DISPLAY=`who -Rm|grep `whoami`|grep -v [|grep -v other_others]|cut -f2 -d"("|cut -f1 -d")"`:0.0;
What does this button do?