Use .bashrc.d directory instead of bloated .bashrc
Bashrc file or .profile are the place where we put the initialization of the bash/zsh/fish shell, and lot’s of software want to add a line here, mainly to init some environment variable, or change path (BTW there is a feature to do that on OSX). The result is a bloated, unreadable file for init. So, let’s split it in several files.
You will be able to list your init parts like this:
denis:~ waxzce$ ls .bashrc.d/
How to switch?
First, create a directory
chmod 700 ~/.bashrc.d
Then add this to your actual .bashrc or .bash_profile (on top)
for file in ~/.bashrc.d/*.bashrc;
Then just split the file inside the ~/.bashrc.d directory with precise MYFILE.bashrc file. You’ll need to give them execution rights too
chmod +x ~/.bashrc.d/*.bashrc
Thank you to Yoann Grange for the picture