Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

test -t can distinguish compile sessions

2 views
Skip to first unread message

Dan Jacobson

unread,
Jun 14, 2003, 12:19:33 AM6/14/03
to
How can a shell script tell that we can't talk back, i.e. we are
either in a batch job or a emacs compile session? test -t doesn't
catch the latter, nor does test -t 0. case $- in *i*) isn't too
helpful either. No, don't tell me how to talk back during compile
sessions, just tell me how to test...
--
http://jidanni.org/ Taiwan(04)25854780

Robert Hundt

unread,
Jun 16, 2003, 5:22:23 PM6/16/03
to
Hey Dan,

I guess you would have to check the process tree (via ps -ef) and see
whether emacs is somwhere the parent of your current shell.

For example (on HP-UX, needs adjustment for your shell):

ps -ef | grep `ps -ef | grep $$ | grep ksh | grep -v grep | awk '{ print
$3 }' ` >out
cat out | grep -v /ksh | grep -v grep | grep /emacs
if [[ $? = 0 ]] then
echo "We are emacs"
fi

-- Robert

"Dan Jacobson" <jid...@jidanni.org> wrote in message
news:8765nc2...@jidanni.org...

Puff Addison

unread,
Jun 17, 2003, 5:34:38 AM6/17/03
to
The tty command does this:
try
$ tty
and
$ cat | tty
^D

Puff Addison


0 new messages