Discussion Locked

Newbie Question - Problem with PATH

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I can't get Linux to retain the PATH. I log in as root and update it as follows:

PATH=$PATH:/usr/local/src/prog
export PATH

This keeps the path for a while (a day or so) but after that I loose it. What do I have to do to retain this silly path? Thanks, MB

1 reply

by ddeback

Lets assume your using bash as a shell, hence
the PATH=$PATH:/usr/local/src/prog.

Bash will read /etc/profile and execute any commands found in this file. If the PATH is
to be changed only for a specific user then
put the PATH=${PATH}:/.....
in the ~/.profile or ~/.bash_profile

Also look in the environment to see what your shell level is.
For instance
SHLVL=2 means I have logged in and started this shell from another shell. If new environment variables are added they will only appear in this shell and shells spawned
from this shell with a SHLVL of 3 or greater.

This discussion is closed to new replies.