I login to a system that reads my bashrc file and loads some software ready to use.
I'd like to load a given bashrc file depending on the linux system that I am logging into.
Specifically, if I am logging into a system with centOS 6, I'd like to load my centos6 bashrc:
cat /etc/*-release CentOS release 6.4 (Final) LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch CentOS release 6.4 (Final) CentOS release 6.4 (Final)
and if I am logging into a system with centOS 5.7, I'd like to load my centOS 5.7 bashrc.
cat /etc/*-release CentOS release 5.7 (Final)
I am thinking along the lines of having 3 bashrc files in my home dir:
.bashrc with an if condition such that if finds that I was logging in into centOS6 would run,
and an else, such that if finds that I was logging in into centOS5.7 would run,
So I guess my .bashrc code would look kind of like this:
if cat /etc/*-release == "CentOs release 6.4" source ~/.bashrc.centos6 elif cat /etc/*-release == "CentOs release 5.7" source ~/.bashrc.centos5
I am still new to bash scripting so I have no idea how I'd do that and if its a god way to go to achieve my goal.