[SOLVED] CentOS8 if condition being ignored
by witchkinkofangmar from LinuxQuestions.org on (#56XVS)
Trying to differentiate between CentOS7 and CentOS8 and the CentOS8 condition is being skipped and I'm not sure why.
Code:release=$(cat /etc/redhat-release | awk '{print $1,$2}')
release8="cut -c22 /etc/redhat-release"
if [[ -d "$sepDir" ]]; then
echo "$(tput setaf 1)$(tput setab 7)Symantec Endpoint Protection is already installed.$(tput sgr 0)"
elif [[ ! -d "$sepDir" && $release == 'Red Hat' ]]; then
echo "$(tput setaf 1)$(tput setab 7)RHEL Install.$(tput sgr 0)"
sepInstallRHEL
elif [[ ! -d "$sepDir" && "$release8" == '8' ]]; then
echo "CentOS 8 install"
sepInstallCentOS8
elif [[ ! -d "$sepDir" && $release == 'CentOS Linux' || $release == 'CentOS release' ]]; then
echo "$(tput setaf 1)$(tput setab 7)CentOS Install.$(tput sgr 0)"
sepInstallCentOS
else
echo "An error has occurred. Please contact your Systems Administrator."
fi


Code:release=$(cat /etc/redhat-release | awk '{print $1,$2}')
release8="cut -c22 /etc/redhat-release"
if [[ -d "$sepDir" ]]; then
echo "$(tput setaf 1)$(tput setab 7)Symantec Endpoint Protection is already installed.$(tput sgr 0)"
elif [[ ! -d "$sepDir" && $release == 'Red Hat' ]]; then
echo "$(tput setaf 1)$(tput setab 7)RHEL Install.$(tput sgr 0)"
sepInstallRHEL
elif [[ ! -d "$sepDir" && "$release8" == '8' ]]; then
echo "CentOS 8 install"
sepInstallCentOS8
elif [[ ! -d "$sepDir" && $release == 'CentOS Linux' || $release == 'CentOS release' ]]; then
echo "$(tput setaf 1)$(tput setab 7)CentOS Install.$(tput sgr 0)"
sepInstallCentOS
else
echo "An error has occurred. Please contact your Systems Administrator."
fi