In git bash (on windows) how can I set an environment variable with special characters in the key? Like some.var:.
The following does not work: export "some.var:"=123
In git bash (on windows) how can I set an environment variable with special characters in the key? Like some.var:.
The following does not work: export "some.var:"=123
export requires a valid bash identifier, so it can only define a subset of legal environment strings.
If you have a program that requires a name that is not a valid identifier, you'll need to use an external program to create the necessary environment. For example:
$ env -i "some.var:=123" env
some.var:=123
env by itself reports its inherited environment. With a command, it runs that command in a possibly modified environment. -i clears the initial environment (so that we aren't flooded with irrelevant environment string; in practice, you can omit it if you want to inherit the current environment as well), and the string defines a name some.var: to have the value 123).