LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   VectorLinux (https://www.linuxquestions.org/questions/vectorlinux-36/)
-   -   Problem with modifying PATH environment variable permanently (VectorLinux 7.0) (https://www.linuxquestions.org/questions/vectorlinux-36/problem-with-modifying-path-environment-variable-permanently-vectorlinux-7-0-a-4175481781/)

DiscobarMolokai 10-22-2013 05:23 PM

Problem with modifying PATH environment variable permanently (VectorLinux 7.0)
 
Hello everyone,

I have some troubles with permanently setting my PATH env var in VectorLinux (7.0). I know that I should add some lines like these to ~/.bash_profile:

PATH=$PATH:/mypath/
export PATH

So now, the path should be modified whenever I'm working in bash. But it does not change. Even after rebooting echo $PATH always gives me the same default PATH in a bash. I also tried editing ~/profile and /etc/profile (in the latter I even inserted my own path directly into the command that creates PATH) only to find that I can never start a terminal without having the PATH set to the default. The only thing that works so far is typing

source ~/.bash_profile

when I start a terminal, then echoing $PATH shows the changes I want to be permanent. I have to do so every time.
What am I doing wrong?

ilesterg 10-23-2013 02:20 AM

Hi,

What is your default login shell?

Code:

echo $SHELL;

DiscobarMolokai 10-23-2013 02:25 AM

Default login shell
 
It's /bin/bash.

druuna 10-23-2013 02:32 AM

@ilesterg: The SHELL variable is bash/ksh specific and will not be set/changed when using, for example, zsh or csh. A better way to determine the login shell is to look in /etc/passwd (grep <username> /etc/passwd).

@DiscobarMolokai: You should only need to edit your ~/.bashrc file if you need to modify this path for some reason.
Is this done for a normal user or for the root user?

DiscobarMolokai 10-23-2013 03:33 AM

A normal user. I just need the shell to find some small programs I frequently use, stored in a directory that's not in the default PATH, without having to type the entire path to them every time. I'll try adding the lines to ~/.bashrc and I'll post if it worked. Thanks

druuna 10-23-2013 03:50 AM

The file that are used when logging in depends on

Interactive login shell: /etc/profile and ~/.bash_profile and ~/.profile
You often see this:
- /etc/profile parses /etc/ash.bashrc
- ~/.profile parses ~/.bashrc

Interactive non-login shell: /etc/bash.bashrc and ~/.bashrc

The system wide PATH is normally set in /etc/profile and assuming that ~/.bashrc is parsed from ~/.profile; ~/.bashrc should be used to add localized PATH settings.

One thing that just comes to mind: Where in the file did you add the PATH=... / export PATH lines? Make sure these are set after the normal PATH= commands.

DiscobarMolokai 10-23-2013 05:44 AM

Ok, I got it now. Thanks for the help!


All times are GMT -5. The time now is 02:18 AM.