bier hier bier hier - 2 months ago 18
Git Question

Set an environment variable in git bash

When I punch from the windows gitbash command line:

set $HOME = c


and do :

echo $HOME


It does not set it to
c
? How can I change/set the value of an environment variable?

Answer

A normal variable is set by simply assigning it a value; note that no whitespace is allowed around the =:

HOME=c

An environment variable is a regular variable that has been marked for export to the environment.

export HOME
HOME=c

You can combine the assignment with the export statement.

export HOME=c
Comments