Skip to main content
Mod Removes Wiki by Oliver Salzburg
added 76 characters in body
Source Link
Billy McCloskey
  • 1.7k
  • 2
  • 19
  • 26

For the bash shell PATH global (non-terminal) environment variables, I follow the convention used in my Ubuntu VM installation - other shells will vary:

Caveat: The whole shell start-up sequence, which .bashrc, .profile, etc. files are sourced in which order?, when do I have to re-login to get visibility to newly defined variables, aliases, etc?, what's the difference between a login, interactive, and non-interactive shell - I do use cron?, and why when I do a . ~/.bashrc is my stupid PATH variable growing longer and longer? are the key questions that come to mind when I'm thinking of my PATH variable.

In fact, I just completely re-wrote my entire bash startup file set taking ideas from the Ubuntu and cygwin skeleton files, and here are some of my in sites:

  1. Export the PATH and other global environment variables (i.e. LD_LIBRARY_PATH) variables in the .profile;
  2. Use logic in ~/.profile to source $HOME/.bashrc if it exists;
  3. Fence execution of the ~/.bashrc with a test for interactive execution, exit otherwise;
  4. Put all the aliases, shopt's, prompt setup, history control, terminal setup, function definition, etc. (interactive related setup) in the part of ~/.bashrc that is protected to only run in interactive mode;
  5. Get rid of the other bash startup files, because their existence determines whether the control path through .profile and .bashrc works as expected. That is, unless there are specific requirements to do otherwise, remove ~/.bash_profile & ~/.bash_login;
  6. When I'm at the bash prompt, and I need to update some default setup, I edit my ~/.bashrc file, then simply source it with a . ~/.bashrc to get those changes in my current shell.
  7. When I make a change to an environment variable like PATH, I need to modify and source my ~/.profile;
  8. I put my calls to fink, port, and brew specific setups in .profile.

That's my 2 cents on this topic.

For the bash shell PATH global (non-terminal) environment variables, I follow the convention used in my Ubuntu VM installation - other shells will vary:

Caveat: The whole shell start-up sequence, which .bashrc, .profile, etc. files are sourced in which order?, when do I have to re-login to get visibility to newly defined variables, aliases, etc?, what's the difference between a login, interactive, and non-interactive shell - I do use cron?, and why when I do a . ~/.bashrc is my stupid PATH variable growing longer and longer? are the key questions that come to mind when I'm thinking of my PATH variable.

In fact, I just completely re-wrote my entire bash startup file set taking ideas from the Ubuntu and cygwin skeleton files, and here are some of my in sites:

  1. Export the PATH and other global environment variables (i.e. LD_LIBRARY_PATH) variables in the .profile;
  2. Use logic in ~/.profile to source $HOME/.bashrc if it exists;
  3. Fence execution of the ~/.bashrc with a test for interactive execution, exit otherwise;
  4. Put all the aliases, shopt's, prompt setup, history control, terminal setup, function definition, etc. (interactive related setup) in the part of ~/.bashrc that is protected to only run in interactive mode;
  5. Get rid of the other bash startup files, because their existence determines whether the control path through .profile and .bashrc works as expected. That is, unless there are specific requirements to do otherwise, remove ~/.bash_profile & ~/.bash_login;
  6. When I'm at the bash prompt, and I need to update some default setup, I edit my ~/.bashrc file, then simply source it with a . ~/.bashrc to get those changes in my current shell.
  7. When I make a change to an environment variable like PATH, I need to modify and source my ~/.profile

That's my 2 cents on this topic.

For the bash shell PATH global (non-terminal) environment variables, I follow the convention used in my Ubuntu VM installation - other shells will vary:

Caveat: The whole shell start-up sequence, which .bashrc, .profile, etc. files are sourced in which order?, when do I have to re-login to get visibility to newly defined variables, aliases, etc?, what's the difference between a login, interactive, and non-interactive shell - I do use cron?, and why when I do a . ~/.bashrc is my stupid PATH variable growing longer and longer? are the key questions that come to mind when I'm thinking of my PATH variable.

In fact, I just completely re-wrote my entire bash startup file set taking ideas from the Ubuntu and cygwin skeleton files, and here are some of my in sites:

  1. Export the PATH and other global environment variables (i.e. LD_LIBRARY_PATH) variables in the .profile;
  2. Use logic in ~/.profile to source $HOME/.bashrc if it exists;
  3. Fence execution of the ~/.bashrc with a test for interactive execution, exit otherwise;
  4. Put all the aliases, shopt's, prompt setup, history control, terminal setup, function definition, etc. (interactive related setup) in the part of ~/.bashrc that is protected to only run in interactive mode;
  5. Get rid of the other bash startup files, because their existence determines whether the control path through .profile and .bashrc works as expected. That is, unless there are specific requirements to do otherwise, remove ~/.bash_profile & ~/.bash_login;
  6. When I'm at the bash prompt, and I need to update some default setup, I edit my ~/.bashrc file, then simply source it with a . ~/.bashrc to get those changes in my current shell.
  7. When I make a change to an environment variable like PATH, I need to modify and source my ~/.profile;
  8. I put my calls to fink, port, and brew specific setups in .profile.

That's my 2 cents on this topic.

Source Link
Billy McCloskey
  • 1.7k
  • 2
  • 19
  • 26

For the bash shell PATH global (non-terminal) environment variables, I follow the convention used in my Ubuntu VM installation - other shells will vary:

Caveat: The whole shell start-up sequence, which .bashrc, .profile, etc. files are sourced in which order?, when do I have to re-login to get visibility to newly defined variables, aliases, etc?, what's the difference between a login, interactive, and non-interactive shell - I do use cron?, and why when I do a . ~/.bashrc is my stupid PATH variable growing longer and longer? are the key questions that come to mind when I'm thinking of my PATH variable.

In fact, I just completely re-wrote my entire bash startup file set taking ideas from the Ubuntu and cygwin skeleton files, and here are some of my in sites:

  1. Export the PATH and other global environment variables (i.e. LD_LIBRARY_PATH) variables in the .profile;
  2. Use logic in ~/.profile to source $HOME/.bashrc if it exists;
  3. Fence execution of the ~/.bashrc with a test for interactive execution, exit otherwise;
  4. Put all the aliases, shopt's, prompt setup, history control, terminal setup, function definition, etc. (interactive related setup) in the part of ~/.bashrc that is protected to only run in interactive mode;
  5. Get rid of the other bash startup files, because their existence determines whether the control path through .profile and .bashrc works as expected. That is, unless there are specific requirements to do otherwise, remove ~/.bash_profile & ~/.bash_login;
  6. When I'm at the bash prompt, and I need to update some default setup, I edit my ~/.bashrc file, then simply source it with a . ~/.bashrc to get those changes in my current shell.
  7. When I make a change to an environment variable like PATH, I need to modify and source my ~/.profile

That's my 2 cents on this topic.