delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/23/10:12:30

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1152385840C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1637680348;
bh=UGI5Eb3L1XdzKjcuTDmPGyfcVHahLVxIRIDzf5OGUcI=;
h=Date:Subject:References:To:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=fYQLGTtoT9ETdQDutJONhd+L1YcJSoE+afXp6P5JMe4pdw1LUCL95YCuhD90c2SJ9
6KqfimH/dGA29g+CXF3K/cxjSHQKaNYhKXy7dbanTWfx7cqM87lX6OITGNJ7HBNlyu
H9KWyk35lkMYxju+BkZJzdLc95n02IOfKVF/u5+A=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCCA53858D28
X-UI-Sender-Class: 214d933f-fd2f-45c7-a636-f5d79ae31a79
Message-ID: <b7920933-7b4a-b785-2832-f852bf9b96f0@mail.com>
Date: Tue, 23 Nov 2021 16:11:11 +0100
MIME-Version: 1.0
Subject: Re: Program files environmental variables
References: <693ff161-60af-7e60-7325-ce0f2b42acc0 AT mail DOT com>
<DB9PR08MB6842C067DA1DB291FBD666A0E9609 AT DB9PR08MB6842 DOT eurprd08 DOT prod DOT outlook DOT com>
To: cygwin AT cygwin DOT com
In-Reply-To: <DB9PR08MB6842C067DA1DB291FBD666A0E9609@DB9PR08MB6842.eurprd08.prod.outlook.com>
X-Provags-ID: V03:K1:iMAk+IPKipDrwjjqEv7CWgK7oNtiTqBJnX8LjEYkUcZ2493oRYo
2Z8k9TjqOLlEge/9REeGQpIv2a10OkvvSLnESUW1/YNtRwCf3Ig+vL6Mahur34qAgBpX8Iu
izUWlC01W2C0+/kPxGFMHRBPh6JHNa1Fj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GU43eMjwYgXAw0UgWMs9gVYtQyUI4xj
MWCtPY0iMfqe1DSnOwgwCkDGYvppLzLLTX2t5PE8aouK9pmOs4V3xTFvGmV4SsiddmaP9nzeI
/n+y92iyAXRc0YfTky+t9Ml7manm1jLIo6a1LOvtnSjqWe5jQfUlhoTTs48lm3z9gotaC1O9K
482mzPcPOz5CG0=
X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS,
TXREP 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 AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: john doe via Cygwin <cygwin AT cygwin DOT com>
Reply-To: john doe <johndoe65534 AT mail DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 11/23/2021 10:37 AM, Daniel Abrahamsson wrote:
> John Doe wrote:
>
>> Cygwins,
>>
>> Is there a way to get the value of PROGRAMFILES(x86) and PROGRAMW6432 in
>> Bash:
>>
>> $ echo $PROGRAMFILES; echo "$PROGRAMFILES(x86)"; echo $PROGGRAMW6432
>> C:\Program Files
>> C:\Program Files(x86)
>>
>> $ cmd.exe /C "echo %PROGRAMFILES% %PROGRAMFILES(x86)% %PROGRAMW6432%"
>> C:\Program Files C:\Program Files (x86) C:\Program Files
>>
>>
>> PROGRAMFILES works in Bash but not the other two.
>>
>> I could not find anything relevent in the archive or when googling.
>>
>> --
>> John Doe
>
> We have a script where we use this workaround:
>
> PROGRAMFILES86=$(env | sed -ne 's/^ProgramFiles(x86)=//p' )
>

I never thought using env like this, an alternative using awk:

$ env | awk -F= '/^ProgramFiles\(x86\)/{print $2}'
C:\Program Files (x86)


printenv is even better! :)

Thanks all for your input much appreciated.

--
John Doe

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019