Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm a newbie to Ubuntu. I want to add some variables to my PATH - I am using the following steps:

  1. Open a terminal window.

  2. Type the following commands:

    export GOROOT=/home/linux/go/hg
    export GOOS=linux
    export GOARCH=386
    export GOBIN=/home/linux/go/bin
    export PATH=$PATH:$GOBIN
    

When I type the following command in a terminal window:

env | grep '^GO'

It shows:

GOBIN=/home/linux/go/bin/
GOARCH=386
GOROOT=/home/linux/go/hg
GOOS=linux

I have tried the following command in a terminal window:

gedit ~/.bashrc

and pasted the following lines at the end of the file:

GOROOT=/home/linux/go/hg
GOOS=linux
GOARCH=386
GOBIN=/home/linux/go/bin

The problem is that env is not showing the above mentioned variables in PATH. Perhaps I am using the wrong command to store the paths, or storing my path variables in the wrong file?

Can someone guide me where and how to store the above mentioned variables in the PATH permanently?

share|improve this question

migrated from stackoverflow.com Jun 29 '11 at 10:24

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 5 down vote accepted

You forgot to export them. Edit your ~/.bashrc to something like this:

export GOROOT=/home/linux/go/hg
export GOOS=linux
export GOARCH=386
export GOBIN=/home/linux/go/bin

If you want the GOBIN available in your search paths, append this line too:

export PATH=$PATH:$GOBIN
share|improve this answer

I believe you need to export the variables in .bashrc as well. Also, you might need to source .bashrc or log out and back in again.

share|improve this answer
  1. Put export before the variables in your .bashrc.
  2. Save the file.
  3. Log in and out / Open new terminal.
  4. Try for example env | grep 'PATH' and your path will show up.
share|improve this answer
    
The env | grep '^GO' is 100% valid regarding to what the op wanted to do. –  shinkou Jun 29 '11 at 5:21
    
Yes, and for that I edited my answer even before your comment. –  Franz Jun 29 '11 at 5:34
    
Sorry, but my browser didn't reload. :P –  shinkou Jun 29 '11 at 5:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.