I'm using bash and have a file called x.config
that contains the following:
MY_VAR=Something1
ANOTHER=Something2
To load these as environment variables I just use source:
$ source x.config
But this doesn't work if MY_VAR
is called MY-VAR
:
MY-VAR=Something1
ANOTHER=Something2
If I do the same thing I get:
x.config:1: command not found: MY-VAR=Something1
I've tried escaping -
and a lot of other things but I'm stuck. Does anyone know a workaround for this?