I'm using the version of bash that comes with msysGit on a Win64 Windows 7 RC machine. I'm trying to test the value of the insanely named PROGRAMFILES(X86) environment variable, but I can't figure out how to check its value. Every way of quoting it that I've tried has failed, backslashes, double quotes, braces, ....

$ env | grep PROGRAM
PROGRAMW6432=C:\Program Files
COMMONPROGRAMW6432=C:\Program Files\Common Files
PROGRAMDATA=C:\ProgramData
COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files
PROGRAMFILES=C:\Program Files (x86)
PROGRAMFILES(X86)=C:\Program Files (x86)

Actually, what I'm really trying to do is to port the following batchfile to bash. See http://weblogs.asp.net/george_v_reilly/archive/2009/09/11/launching-32-bit-applications-from-batchfiles-on-win64.aspx for background.

@setlocal
@set _pf=%ProgramFiles%
@if not "[%ProgramFiles(x86)%]"=="[]" set _pf=%ProgramFiles(x86)%
@start "" /b "%_pf%\SourceGear\DiffMerge\DiffMerge.exe" %*

Thanks
--
/George V. Reilly  george@reilly.org  Twitter: @georgevreilly
http://www.georgevreilly.com/blog  http://blogs.cozi.com/tech
Approve Referendum 71 to keep the Domestic Partnership Law: http://approve71.org