delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/03/13:31:40

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4D6FDE68.8040705@cpan.org>
Date: Thu, 03 Mar 2011 13:31:04 -0500
From: Rafael Kitover <rkitover AT cpan DOT org>
Reply-To: rkitover AT cpan DOT org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Detect mintty in .zshrc?
References: <4D6F690F DOT 9010100 AT cpan DOT org> <AANLkTimSwLjFOPk=v7HKfzjm1hdv+4MWfNBPEVYfsGbD AT mail DOT gmail DOT com>
In-Reply-To: <AANLkTimSwLjFOPk=v7HKfzjm1hdv+4MWfNBPEVYfsGbD@mail.gmail.com>
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

On 3/3/2011 7:21 AM, Andy Koppe wrote:
> On 3 March 2011 10:10, Rafael Kitover wrote:
>> I was wondering if there's a way in my .zshrc to determine if the shell
>> is running in mintty or in a regular windows console.
> 
> Check $TERM. It defaults to 'xterm' in mintty and 'cygwin' in the console.
> 
> Andy

Thank you, that works for me, I put this block at the top of my .zshrc:

if [ "$TERM" = "cygwin" -o "$TERM" = "dumb" ]; then
  export RUNNING_IN_CONSOLE=1
  export TERM=cygwin
fi

later I switch on "$RUNNING_IN_CONSOLE" to see if I'm in a real console.

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