From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Puff Addison Newsgroups: gmane.emacs.help Subject: Re: test -t can distinguish compile sessions Date: Tue, 17 Jun 2003 10:34:38 +0100 Organization: University College London 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 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1055842918 5373 80.91.224.249 (17 Jun 2003 09:41:58 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 17 Jun 2003 09:41:58 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 17 11:41:57 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 19SCyS-0001OG-00 for ; Tue, 17 Jun 2003 11:41:56 +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 19SCxb-0000Zu-7U for gnu-help-gnu-emacs@m.gmane.org; Tue, 17 Jun 2003 05:41:03 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!server3.netnews.ja.net!ucl.ac.uk!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: tsg40d.tsg.ucl.ac.uk Original-X-Trace: uns-a.ucl.ac.uk 1055842533 18694 128.40.28.40 (17 Jun 2003 09:35:33 GMT) Original-X-Complaints-To: usenet@ucl.ac.uk Original-NNTP-Posting-Date: 17 Jun 2003 09:35:33 GMT User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030529 X-Accept-Language: en-us, en In-Reply-To: Original-Xref: shelby.stanford.edu gnu.emacs.help:114501 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:10993 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10993 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" 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