Everytime I log into SSH, I have to manually source the bashrc file to set my path variables the way I want to. How do I have bash do it automatically? Shouldn't it be automatic?
|
There is the If it doesn't work for you, you either use a wrong filename (missing "." from beginning?), or you don't use bash as your shell. In the latter case, try
|
|||||
|
|
You should also know about $BASH_ENV . What files are read by bash when it starts up depends on if the session is interactive or not. Occasionally there can be an issue where it's not clear if the session is interactive. So besides ~/.bashrc you might want to also export and set variable BASH_ENV to point to a file containing the PATH and other settings that you need. BASH_ENV can be set to point to your .bashrc file (sometimes it's .bash_rc) so long as there are no interactive commands in there (to be safe use a separate file, say ~/.bash_env). From the bash man pages: When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc. When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. Bash behaves as if the following command were executed:
but the value of the PATH variable is not used to search for the file name. |
|||
|
|
|
I know this is old, but i think on a new login shell, bash looks for a single file to run. It looks for .bash_profile, then .profile, then .bashrc. If it finds .bash_profile or .profile, it won't further look for .bashrc. Solution, put in your .profile:
|
|||
|
|
~/.bashrc? Probably for PATH I'd put it in~/.bash_profile. Either way, the dot is necessary. – mpez0 Apr 12 '10 at 20:58