function centos7 {
release=`cat /etc/redhat-release|awk '{print $4}'|grep ^[7]`
if [ "$release" != "" ]; then
centos7='yes'
fi
}
centos7
echo "$centos7"
We create a function called "centos7" and then call it by just typing "centos7"
We then access a variable that may be set if we are running centos7 which is also called "$centos7".
If the value is present it should be = "yes" which means we are running Centos 7.
bash, scripting, functionfunction, centos, etc, redhat, awk, grep, quot, fi, echo, typing, variable,