From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Robert Hundt" Newsgroups: gmane.emacs.help Subject: Re: test -t can distinguish compile sessions Date: Mon, 16 Jun 2003 21:22:23 GMT Organization: Hewlett-Packard Company Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <8765nc2i6n.fsf@jidanni.org> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1055797467 27118 80.91.224.249 (16 Jun 2003 21:04:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Jun 2003 21:04:27 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 16 23:04:24 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19S19M-00072s-00 for ; Mon, 16 Jun 2003 23:04:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19S1B9-0006of-NA for gnu-help-gnu-emacs@m.gmane.org; Mon, 16 Jun 2003 17:06:15 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!news.cpqcorp.net!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Original-NNTP-Posting-Host: 15.244.99.34 Original-X-Complaints-To: abuse@HP.com Original-X-Trace: news.cpqcorp.net 1055798543 15.244.99.34 (Mon, 16 Jun 2003 14:22:23 PDT) Original-NNTP-Posting-Date: Mon, 16 Jun 2003 14:22:23 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:114495 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10987 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10987 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" 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