Fish shell: Set variable outside of current shell

I would like to create the variable $EIGENto save the path where I installed the Eigen library in order to link in with my compiler. For this I was using set EIGEN path/to/eigen

However if I echo $EIGEN in another shell there is no output.


Solution 1:

If you want a variable to be set for every shell launched then you should edit the default profile.

By default that file is located at ~/.config/fish/config.fish, where ~ is your user home directory. If you do not have that file then you should create it. In that file you can enter the same command you used to set the $EIGEN value in your normal shell.

You can find more at Fish Shell FAQ

If you need to set the value for every program then you should consult the documentation for your operating system which should tell you how to set environment variables globally.