Im having a day in which everything I touch is turning brown and sticky...
I want to find the owner and machine hosting a remote tty session. If I type "who" I get
If I do "tty | sed s^/dev/^^" in a sample shell I get the result "pts/3" I then want to extract the relevant line in the "who" result to find out the owner of the tty and the machine (in this example it is godfrey on saturn).
So I tried;
but both fail miserably. However "who | grep pts/3" works. If I make a separate env for the tty part and then do the grep with that, it also works.
What am I doing wrong?
I want to find the owner and machine hosting a remote tty session. If I type "who" I get
Code:
root tty1 Feb 1 12:42
david pts/0 Feb 10 08:47 (venus)
godfrey pts/2 Feb 4 11:42 (saturn)
godfrey pts/3 Feb 11 17:54 (saturn)
david pts/1 Feb 10 16:36
godfrey pts/4 Feb 11 16:10 (saturn)
browning pts/6 Feb 10 15:07
browning pts/5 Feb 10 13:55 (venus)
If I do "tty | sed s^/dev/^^" in a sample shell I get the result "pts/3" I then want to extract the relevant line in the "who" result to find out the owner of the tty and the machine (in this example it is godfrey on saturn).
So I tried;
Code:
grep `tty|sed s^/dev/^^` `who`
and
who | grep `tty|sed s^/dev/^^`
but both fail miserably. However "who | grep pts/3" works. If I make a separate env for the tty part and then do the grep with that, it also works.
What am I doing wrong?