This is the mail archive of the
cygwin-talk
mailing list for the cygwin project.
Re: cygwin detection
- From: Robert Pendell <shinji257 at uplink dot net>
- To: cygwin-talk at cygwin dot com
- Date: Fri, 29 Sep 2006 13:08:24 -0400
- Subject: Re: cygwin detection
- Openpgp: id=D146D4B4
- References: <001601c6e3ce$403f0d80$be32000a@idirect.net> <20060929154930.GA1132@home>
- Reply-to: The Cygwin-Talk Maiming List <cygwin-talk at cygwin dot com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
George wrote:
> 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.
>
Dang. Don't forget about Netbsd or Openbsd.
- --
Robert Pendell
shinji257@uplink.net
Thawte Web of Trust Notary
CAcert Assurer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
iD8DBQFFHVMIOzNfzNFG1LQRAgACAKC/0DVL+aUNXuTqNHW7BhxaK7aCGgCdH6HW
qsQW61GvjRcp6r3XxaReoCQ=
=l6bv
-----END PGP SIGNATURE-----