delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/05/25/09:34:35

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,SPF_HELO_PASS,TW_HR,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-IronPortListener: Outbound_SMTP
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AhAFAPSIv0+cKEcU/2dsb2JhbABFsUiDW4EHghYBAQQSKE8CAQgNJwIQHxMlAQEEARoah2ueaJxQiwGEZmADjHmOEIl/gnw
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>,
Andrew Hancock <andymhancock AT gmail DOT com>
Date: Fri, 25 May 2012 09:32:50 -0400
Subject: RE: Bashrc distinguish between mintty and x-windows xterm
Message-ID: <0105D5C1E0353146B1B222348B0411A20A770C7EF3@NIHMLBX02.nih.gov>
References: <CAGU3OVyzt3r+raKuFEnb1AKkqfzHQy1DPFukJSU8mQyR_3gr9g AT mail DOT gmail DOT com> <CAGU3OVwL-69=3pN=4dgCEamQnd5VnnCPRpi-grpO-ciUgTrnuw AT mail DOT gmail DOT com>
In-Reply-To: <CAGU3OVwL-69=3pN=4dgCEamQnd5VnnCPRpi-grpO-ciUgTrnuw@mail.gmail.com>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q4PDYUPF024526

Andrew Hancock sent the following at Friday, May 25, 2012 12:42 AM
>Barry, it works flawlessly. Thanks immensely!

You are very welcome.

But I forgot to export ThisTerm, otherwise it is always unset when
a subshell is launched.

# Only set ThisTerm if not set.
if [ -z "${ThisTerm}" ]
then
  if [ ${PPID} = 1 ]
  then
    ThisTerm=cmd
  else
    if [ "$(cat /proc/${PPID}/exename)" = '/usr/bin/mintty' ]
    then
      ThisTerm=mintty
    else
      # not minty, not cmd, so xterm
      ThisTerm=xterm
    fi
  fi
  export ThisTerm
fi

One could test exename for /usr/bin/xterm instead of assigning by
the process of elimination.

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.


--
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