[comp.unix.i386] finding out what terminal you are logged into under VP/ix

harley@cs.utexas.edu (Harley Hahn) (07/11/90)

Here is a neat trick.

I wanted to set my DOS prompt under VP/ix to tell me what
terminal I was logged in to.
However, there is no way to directly access this information
from DOS and there is no way (that I could find) to set a DOS
variable from Unix.

But, here's how you can do it.

Create a directory, call it, say, WHEREAMI.
In your AUTOEXEC file, change to WHEREAMI and delete
all the files.
Then, execute the following Unix command.  Even though it is in 
a DOS batch file, VP/ix will make it work:

   touch `basename \`tty\``

This will create a file with the name of your terminal,
VT01, VT02, CONSOLE, or whataver.

Next, use the IF EXIST statement to find which of these
files exists and set the prompt accordingly.

I have tested this and it works.