1

What is the easiest way to tell RHEL5 from RHEL6 in a bash script?

view story
linux-howto

http://unix.stackexchange.com – I work in an environment where we are slowly transitioning machines from Red Hat Enterprise Linux 5 to RHEL 6. I need some of my scripts to do something subtly different on RHEL6 machines to what is currently being done on RHEL5 machines. The pragmatic solution is to check at runtime and run some commands on RHEL5, others on RHEL6 and some on both. A practical example of this is that we are using environment modules and my .bashrc includes a module load git line, but on RHEL6 machines this command errors: RHEL6 system, git should be installed - not loading module Looking in the modulefil (HowTos)