Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: determining port id Message-ID: <1991Mar20.003949.6035@athena.mit.edu> Date: 20 Mar 91 00:39:49 GMT References: <1991Mar19.171708.18628@wciu.EDU> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 34 (Note: "Followup-To: comp.unix.questions, george@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@wciu.EDU>, george@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710