bash scripts and start-up files

Just my personal opinion – but with many years of experience on my back:

  • most shell scripts (bash, ksh, csh) should be run without ~/.bashrc (or equivalent) – bash has “--norc” for that purpose, csh has “-f
  • the PATH environment variable should be set within ~/.profile …, not within ~/.bashrc – do it once at the beginning of the entire session and not often, and do not slow down all utilities’ start-up times

Of course there is always a reason to deviate from rule – but it needs proper justification.

Today I introduced “--norc” within /usr/bin/lessopen.sh on SUSE Linux, and it helped me avoid a weird error message I have read for years now again and again.


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.