From: john doe <johndoe65534@mail.com>
To: cygwin@cygwin.com
Subject: Re: Program files environmental variables
Date: Tue, 23 Nov 2021 16:11:11 +0100 [thread overview]
Message-ID: <b7920933-7b4a-b785-2832-f852bf9b96f0@mail.com> (raw)
In-Reply-To: <DB9PR08MB6842C067DA1DB291FBD666A0E9609@DB9PR08MB6842.eurprd08.prod.outlook.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
next prev parent reply other threads:[~2021-11-23 15:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-23 9:02 john doe
2021-11-23 9:52 ` Csaba Raduly
2021-11-23 10:40 ` Lemures Lemniscati
2021-11-23 13:10 ` Eliot Moss
2021-11-23 15:15 ` john doe
2021-11-23 15:27 ` Eliot Moss
[not found] ` <DB9PR08MB6842C067DA1DB291FBD666A0E9609@DB9PR08MB6842.eurprd08.prod.outlook.com>
2021-11-23 15:11 ` john doe [this message]
2021-11-23 18:07 ` Brian Inglis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b7920933-7b4a-b785-2832-f852bf9b96f0@mail.com \
--to=johndoe65534@mail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).