This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: Bashrc distinguish between mintty and x-windows xterm
- 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
- References: <CAGU3OVyzt3r+raKuFEnb1AKkqfzHQy1DPFukJSU8mQyR_3gr9g@mail.gmail.com> <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