X-Spam-Check-By: sourceware.org Date: Fri, 29 Sep 2006 08:49:30 -0700 From: George To: cygwin AT cygwin DOT com Subject: Re: cygwin detection Message-ID: <20060929154930.GA1132@home> Mail-Followup-To: cygwin AT cygwin DOT com References: <001601c6e3ce$403f0d80$be32000a AT idirect DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001601c6e3ce$403f0d80$be32000a@idirect.net> User-Agent: Mutt/1.4.2.1i X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 Fri, Sep 29, 2006 at 09:50:40AM -0400, Kenneth Nellis wrote: > I have bash scripts that I want to run identically under Cygwin and > Linux, which sometimes require the scripts to detect the environment > and branch accordingly. There are numerous ways to do Cygwin detection, > but I was wondering what technique should work with the widest audience > and be most immune to future Cygwin developments. The widest audience, in your case, being one? ;-) > FWIW, below are various techniques that work for *me* *today*, some of > which have obvious flaws. > > [...] #!/bin/sh case "`uname`" in Linux ) echo "Don't fear the penguin." ;; CYGWIN* ) echo "Don't fear the hippos!" ;; FreeBSD ) echo "This is Unix. I know this." ;; * ) echo "God just killed a kitten." ;; esac FWIW, you may want to consider doing the same to your .bashrc, etc. files. I can't imagine, for example, such things as aliases on a Windows+Cygwin system being useful across platforms. -- George -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/