Need to capture user's tty within lp's interface script!

Need to capture user's tty within lp's interface script!

Post by Karl Dieteri » Sat, 19 Mar 1994 23:19:14



I'm trying to capture the name of a users tty when they issue an

    $lp -dMyPrinter filename

Within my /usr/spool/lp/interface/MyPrinter interface script I can have:

    who am i > /wide/open/dir/myttyfile   - creates a 0 byte file!??
    TmpVar="`who am i`"                - TmpVar gets nothing, exported or not.?

However;

    who am i > /dev/pty/tty01  - a redirect to the hardcoded tty gives me what
                                 I expect echoed to the terminal:
                                 myuserid  pty/tty01  date etc..
If the "who am i" can be redirected to a tty, why can't it be captured to
a file or variable?

I can grep on who -u for my userid, by if I'm logged in more than
once, I don't know which tty is the current one.

This is for an HP 9000 series 800 running hpux 9.0.
Any suggestions would be greatly appreciated. Thanks!

--

Karl Dieterich