[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test -t can distinguish compile sessions

From: Puff Addison
Subject: Re: test -t can distinguish compile sessions
Date: Tue, 17 Jun 2003 10:34:38 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030529

Robert Hundt wrote:
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"

-- Robert

"Dan Jacobson" <address@hidden> wrote in message

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...
-- Taiwan(04)25854780

The tty command does this:
$ tty
$ cat | tty

        Puff Addison

reply via email to

[Prev in Thread] Current Thread [Next in Thread]