delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/05/25/10:50:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=2.9 required=5.0 tests=AWL,BAYES_00,BOTNET,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_YE,SPF_NEUTRAL,TW_HR
X-Spam-Check-By: sourceware.org
Date: Fri, 25 May 2012 10:49:33 -0400
From: Ken Jackson <cygwin AT jackson DOT io>
To: cygwin AT cygwin DOT com
Subject: Re: Bashrc distinguish between mintty and x-windows xterm
Message-id: <20120525144932.GA4534@corel>
References: <CAGU3OVyzt3r+raKuFEnb1AKkqfzHQy1DPFukJSU8mQyR_3gr9g AT mail DOT gmail DOT com> <CAGU3OVwL-69=3pN=4dgCEamQnd5VnnCPRpi-grpO-ciUgTrnuw AT mail DOT gmail DOT com> <0105D5C1E0353146B1B222348B0411A20A770C7EF3 AT NIHMLBX02 DOT nih DOT gov>
MIME-version: 1.0
In-reply-to: <0105D5C1E0353146B1B222348B0411A20A770C7EF3@NIHMLBX02.nih.gov>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

==== Fri, May 25, 2012 at 09:32AM -0400 Buchbinder, Barry (NIH/NIAID) [E] wrote:
> Andrew Hancock sent the following at Friday, May 25, 2012 12:42 AM
> >Barry, it works flawlessly. Thanks immensely!
> 
> But I forgot to export ThisTerm, otherwise it is always unset when
> a subshell is launched.

Access to the /proc file system is fast, so you could forgo the
variable and access it directly:

case "$(< /proc/$PPID/exename)" in
    */xterm)  echo "This is an xterm" ;;
    */mintty) echo "This is a mintty" ;;
esac

I don't have a need for this, but I had wondered how I would do it
if I did.  So I'm glad you posted this.

-Ken Jackson

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019