cpp
cpp

Reputation: 3801

Where exactly in .bashrc set PATH?

At the end of .bashrc file I added these lines to set path to foo folder in my home directory:

PATH = $PATH:/home/username/foo
export PATH;

Then I typed in bash:

source .bashrc

These produced error:

bash: PATH: command not found

I am using Debian Squeeze. In a similar question here it was advised to modify /etc/login.defs. I don't want to do this as in the very login.defs it is written:

add the rest [of your paths] in the shell startup files

How to add folder foo to PATH in .bashrc?

Upvotes: 6

Views: 52960

Answers (3)

Ayush Kumar Sharma
Ayush Kumar Sharma

Reputation: 51

There are differences in syntax between the one used on mac and CentOS, however on CentOS and RedHat the following syntax is being used.

export PATH="/path/directory:$PATH" then do source .bashrc

I am not sure about other distributions of Linux but it will work on CentOS and RedHat.

Upvotes: -1

mehtabsinghmann
mehtabsinghmann

Reputation: 66

Just use the following line in your .bashrc

export PATH=/home/username/foo:$PATH

Upvotes: 4

nmaier
nmaier

Reputation: 33162

You are using the wrong syntax. Drop the spaces:

export PATH=$PATH:/home/username/foo

Regarding /etc/login.defsor any other global configuration: Well, it is global configuration, so probably a bad idea to add paths within your $HOME directory there. ;)

Upvotes: 30

Related Questions