# linux environment variables

This topic is 4344 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I downloaded the binaries for the gcc fortran compiler. However, I want to be able to access this compiler anywhere in the terminal (not only where the executable is)... i think this has something to do with setting environment variables...? Any help? Huge thanks

##### Share on other sites
Is this a local copy that you installed in your home directory or a global install? If it's the former, you can set the PATH variable in ~/.bashrc to include the directory where the binary is:
export PATH=$HOME/path/to/gcc:$PATH

Note: make sure the path points to the directory where the binary is, whether or not it's the toplevel gcc(fortran) directory.

If you installed it globally it should already be accessible in either /usr/bin or /usr/local/bin .

edit:
Also, if you modify .bashrc and don't want to reopen a terminal for it to take effect, you can just do source ~/.bashrc .

##### Share on other sites
Oftentimes, a new user's path will already include ~/bin . This is the standard place to put an individual user's binaries (as opposed to ones everyone on the system uses).

##### Share on other sites
iw onder why you "downloaded the gcc fortran binarys" ... isnt he in the source tree?

and why dont you download a package instead of the binarys? ... you wouldnt have thees kinda problems if you did

##### Share on other sites
Hmm, I just noticed this was in general programming. In case you have any more questions, you can always stop by the Everything Unix forum.

##### Share on other sites
The other way to do this sort of thing is to write a wrapper script that would sit in your PATH and would call the actual binary. Something like

#!/bin/bash/path/to/binary/g77 $* This also gives you the flexibility of running multiple versions side-by-side as you can do #!/bin/bash/path/to/binary/${FORTRAN_VERSION}/g77 \$*

Then in your .bash_rc you can "export FORTRAN_VERSION=whatever" and the script will resolve the version for you at runtime

##### Share on other sites
Quote:
 Original post by bytecoderHmm, I just noticed this was in general programming. In case you have any more questions, you can always stop by the Everything Unix forum.

Moved appropriately.

• 9
• 9
• 13
• 41
• 15