View Full Version : [all variants] dissapearing Shell variables

December 7th, 2009, 03:14 AM
I installed the Go compiler and when I set the shell variables:

export GOROOT=$HOME/go
export GOARCH=386
export GOOS=linux
export GOBIN=$HOME/bin
And then it works fine, but when i close the console window, and then open again the shell variables have dissapeared :confused:

Some Penguin
December 7th, 2009, 04:04 AM
Environments are on a per-shell basis. That is, per-shell-instance -- multiple terminal windows will be running different instances of the shell and thus have different environments.

Add the 'export' commands to your ~/.bash_profile file so that every bash invocation will use 'em.

December 7th, 2009, 04:07 AM
Better to put them in your .bashrc -- in my experience, .bash_profile isn't executed unless you log in through a tty.

December 7th, 2009, 12:34 PM
It works perfectly now, thanks for helping.
So, .bashrc is a kind of script which executes everytime I open a console ?

December 7th, 2009, 01:37 PM
More or less, yes. To be more specific, its executed each time Bash is started by a user.