Brian Inglis writes:

> On 2022-02-08 15:01, julie77...@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: h...@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

Reply via email to