MACSCRPT Archives

December 2007

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Steven D. Majewski" <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 19 Dec 2007 11:44:40 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
I've got a small shell script that executes an applescript via osascript
to set the terminal background & foreground colors ( looking them up in
/usr/X11R6//lib/X11/rgb.txt if they are names rather than numbers. )

I would like to extend this script to work with iTerm.

Any ideas on the best way to figure out whether Terminal.app or  
iTerm.app
is the 'owner' of the  tty where the shell script is executing ?

The only way I can think of is using 'lsof' , and that seems like a  
pretty
indirect route:

$ tty
/dev/ttyp1

$ lsof -c Terminal | grep '/dev'
Terminal 238 sdm7g    0r    VCHR        3,2      0t0 42135940 /dev/null
Terminal 238 sdm7g    1w    VCHR        0,0    0t906 42136580 /dev/ 
console
Terminal 238 sdm7g    2w    VCHR        0,0    0t906 42136580 /dev/ 
console
Terminal 238 sdm7g   11u    VCHR        5,1   0t2701 42376836 /dev/ptyp1


The shell's tty and Terminal.app's pty are the slave/master pair of  
pseudo
terminal devices -- different names, but I'm guessing the last digits  
will
always match up.


Any other ideas ?

-- Steve Majewski / UVA Alderman Library

ATOM RSS1 RSS2