unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* test -t can distinguish compile sessions
@ 2003-06-14  4:19 Dan Jacobson
  2003-06-16 21:22 ` Robert Hundt
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Jacobson @ 2003-06-14  4:19 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: test -t can distinguish compile sessions
  2003-06-14  4:19 test -t can distinguish compile sessions Dan Jacobson
@ 2003-06-16 21:22 ` Robert Hundt
  2003-06-17  9:34   ` Puff Addison
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Hundt @ 2003-06-16 21:22 UTC (permalink / raw)


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" <jidanni@jidanni.org> wrote in message
news:8765nc2i6n.fsf@jidanni.org...
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: test -t can distinguish compile sessions
  2003-06-16 21:22 ` Robert Hundt
@ 2003-06-17  9:34   ` Puff Addison
  0 siblings, 0 replies; 3+ messages in thread
From: Puff Addison @ 2003-06-17  9:34 UTC (permalink / raw)


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"
> fi
> 
> -- Robert
> 
> "Dan Jacobson" <jidanni@jidanni.org> wrote in message
> news:8765nc2i6n.fsf@jidanni.org...
> 
>>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
> 
> 
> 
The tty command does this:
try
$ tty
and
$ cat | tty
^D

	Puff Addison

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-17  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-14  4:19 test -t can distinguish compile sessions Dan Jacobson
2003-06-16 21:22 ` Robert Hundt
2003-06-17  9:34   ` Puff Addison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).