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?
Open the . bashrc file in your home directory (for example, /home/your-user-name/. bashrc ) in a text editor. Add export PATH="your-dir:$PATH" to the last line of the file, where your-dir is the directory you want to add.
To set $PATH globally, you'll need to add the directory using the same command you used while adding temporary and permanent setup, but either in the /etc/environment or the /etc/profile file.
The PATH environment variable is an important security control. It specifies the directories to be searched to find a command. The default systemwide PATH value is specified in the /etc/profile file, and each user normally has a PATH value in the user's $HOME/. profile file.
You are using the wrong syntax. Drop the spaces:
export PATH=$PATH:/home/username/foo
Regarding /etc/login.defs
or any other global configuration: Well, it is global configuration, so probably a bad idea to add paths within your $HOME
directory there. ;)
Just use the following line in your .bashrc
export PATH=/home/username/foo:$PATH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With