public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder@niaid.nih.gov>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>,
	Andrew Hancock	<andymhancock@gmail.com>
Subject: RE: Bashrc distinguish between mintty and x-windows xterm
Date: Fri, 25 May 2012 14:19:00 -0000	[thread overview]
Message-ID: <0105D5C1E0353146B1B222348B0411A20A770C7EF3@NIHMLBX02.nih.gov> (raw)
In-Reply-To: <CAGU3OVwL-69=3pN=4dgCEamQnd5VnnCPRpi-grpO-ciUgTrnuw@mail.gmail.com>

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

  reply	other threads:[~2012-05-25 13:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAGU3OVyzt3r+raKuFEnb1AKkqfzHQy1DPFukJSU8mQyR_3gr9g@mail.gmail.com>
2012-05-25  6:56 ` Andrew Hancock
2012-05-25 14:19   ` Buchbinder, Barry (NIH/NIAID) [E] [this message]
2012-05-25 14:53     ` Ken Jackson
2012-05-26 21:10       ` Andy
2012-05-22  0:39 Andy
2012-05-22  3:09 ` Buchbinder, Barry (NIH/NIAID) [E]
2012-06-20  3:08   ` Andy
2012-06-25  1:46     ` Andy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0105D5C1E0353146B1B222348B0411A20A770C7EF3@NIHMLBX02.nih.gov \
    --to=bbuchbinder@niaid.nih.gov \
    --cc=andymhancock@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).