Sample Header Ad - 728x90

Unusual symbols (parentheses) in the name of an environment variable

0 votes
4 answers
98 views
**Situation.** I work in Cygwin and there is a Windows environment variable that points to one of special folders: ProgramFiles(x86)=C:\Program Files (x86) As you see the variable name contains parentheses. Naive attempts to read the value do not seem to work: echo "${ProgramFiles(x86)}" # bad substitution echo "${ProgramFiles\(x86\)}" # bad substitution I tried to find general rules on escaping characters in variable names, but failed. **Question.** Is it possible to use a variable whose name includes parentheses or other unusual symbols? P. S. In my specific case I got the same value with cygpath -F 42.
Asked by Mikhail Edoshin (103 rep)
Mar 15, 2025, 11:56 AM
Last activity: Mar 16, 2025, 07:58 PM