cygwin detection
Robert Pendell
shinji257@uplink.net
Fri Sep 29 18:02:00 GMT 2006
-----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-----
More information about the Cygwin-talk
mailing list