I have 2 system one is rhel4 and other is rhel6. While compiling I want to distinguish and compile accordingly.
My approach :
in rhel5 machine
-bash-4.1$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5
in rhel4 machine
-bash-3.00$ cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4
So I am thinking to use something like this-
OSVERSION = cat /etc/redhat-release | cut -d "." -f 1 | cut -d " " -f 7
ifeq(OSVERSION,4)
XXXXXXXXXXX
else
YYYYYYYYYYY
endif
Is there any better way to do this? Any flag which contains this information by default and I can use it?