determining port id
Jonathan I. Kamens
jik at athena.mit.edu
Wed Mar 20 10:39:49 AEST 1991
(Note: "Followup-To: comp.unix.questions, george at wciu.edu" is not valid for
two reasons. The first is that there shouldn't be any spaces in it. And the
second is that you can't put E-mail addresses in the Followup-To line. You
must put either a list of newsgroups or the word "poster" to ask for E-mail
replies only.)
In article <1991Mar19.171708.18628 at wciu.EDU>, george at wciu.wciu.edu (George Peavy) writes:
|> What I have so far: I'm using Bourne shell on AT&T Sys V 3.0 running on a
|> Unisys 6000/51 platform. I can get the port id with,
|>
|> who am i | awk '{ print $2 }'
|>
|> The question is, how do I get this information into a place where I can
|> test the value? Is there a simpler way than my use of awk?
If you really want to use awk, then you can use backquotes to evaluate the
command above and assign its output to a variable, e.g.
tty=`who am i | awk '{ print $2 }'`
However, it seems to me that the "tty" command will give you the same
information, and only requires one process:
tty=`tty`
The output of tty will have "/dev/" at the front of it (assuming that your
devices are in /dev :-), but you can cope with that rather trivially.
--
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8085 Home: 617-782-0710
More information about the Comp.unix.questions
mailing list