I have been working on Linux for almost 3 years now and have grown to love it a lot.
As with every linux user, the .bashrc file becomes cumbersome and difficult to maintain over a period of time, since there are a lot of project specific aliases, paths, etc
So after working on a couple of projects, I started maintaining separate files for my environment settings. So I just had to create a separate project setting file:
alias myAlias1=’cd /to/project/dir’
alias projectqa=’ssh to@qa’
alias projectDb=’mysql -u<username> -p<password> <project_db_name>’
So, everytime I had to add more project specific settings or separate my settings, I had to create a new settings file and then source it in my .bashrc by adding this line
As you can guess, after doing this a couple of times, even this was becoming very tedious.
So, I tried to follow the golden rule of convention over configuration.
In my .bashrc, I added the following function :
for i in `find $FOLDER_TO_BE_SOURCED -type f`;
##don’t forget to execute the function
and placed all my setting files into the folder :
So, now if I have to add more settings to my .bashrc, I just create a new executable file in this folder and it gets automatically sourced.
Goodbye messy .bashrc, welcome organized (segregated) settings 🙂