X-Recipient: archive-cygwin@delorie.com
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DFE373858D20
Authentication-Results: sourceware.org;
 dmarc=pass (p=none dis=none) header.from=inf.ed.ac.uk
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=inf.ed.ac.uk
To: <cygwin@cygwin.com>
Subject: Re: CygwinPaltform Identification
References: <337301d81d37$7afda680$70f8f380$@gmail.com>
 <f2da839b-5304-2c5d-9e5b-083fadfe3768@SystematicSw.ab.ca>
From: "Henry S. Thompson" <ht@inf.ed.ac.uk>
Date: Wed, 09 Feb 2022 09:12:12 +0000
In-Reply-To: <f2da839b-5304-2c5d-9e5b-083fadfe3768@SystematicSw.ab.ca> (Brian
 Inglis's message of "Tue\, 8 Feb 2022 18\:46\:07 -0700")
Message-ID: <f5by22kqu8j.fsf@ecclerig.inf.ed.ac.uk>
User-Agent: Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b34 (linux)
MIME-Version: 1.0
X-Edinburgh-Scanned: at seine.is.ed.ac.uk
X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
 SPF_HELO_PASS, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

Brian Inglis writes:

> On 2022-02-08 15:01, julie77793@gmail.com wrote:
>> Cygwin doesn't create an environment variable in bash to indicate that the
>> platform is Cygwin under Windows.
>> ...
>
> I have been switching env/OS/arch/triple dependent profile and rc files
> and sections for years with:
>
> 64 $ echo $OSTYPE $OS $HOSTTYPE $MACHTYPE
> cygwin Windows_NT x86_64 x86_64-unknown-cygwin
> ...

When I don't know or can't remember what variable has the information
I want, printenv is my first stop, e.g.

  64> printenv | grep -i cygwin
  Cygwin=server
  PATH=...

As Brian pointed out, that doesn't find what you need, because it only
lists environment variables, but this does:

  64> declare -p | grep -i cygwin
  declare -ar BASH_VERSINFO=([0]="4" [1]="4" [2]="12" [3]="3" [4]="release" [5]="x86_64-unknown-cygwin")
  declare -x Cygwin="server"
  declare -- MACHTYPE="x86_64-unknown-cygwin"
  declare -- OSTYPE="cygwin"
  declare -x PATH=...

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                       URL: http://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
