Article 58PQQ Bash script conditional not working

Bash script conditional not working

by
witchkinkofangmar
from LinuxQuestions.org on (#58PQQ)
I have two functions, one for CentOS7 and one for CentOS8. My code only runs the CentOS7 function even if it's on a CentOS8 machine. I'm not sure why:

Code:release=$(cat /etc/redhat-release | awk '{print $1,$2}')
release8=$(cut -c22 /etc/redhat-release)

if [[ $release == 'CentOS Linux' || $release == 'CentOS release' && $release8 == '7' ]]; then
echo "CentOS Install"
secureInstall
elif [[ $release == 'CentOS Linux' || $release == 'CentOS release' && $release8 == '8' ]]; then
echo "CentOS 8 Install"
secureInstall8
elif [[ $release == 'Red Hat' ]]; then
echo "RHEL Install"
secureInstall
else
echo "Unsupported OS. Contact Support"
filatest?d=yIl2AUoC8zA latest?i=zUjOTftL848:k57jb_Ilzrg:F7zBnMy latest?i=zUjOTftL848:k57jb_Ilzrg:V_sGLiP latest?d=qj6IDK7rITs latest?i=zUjOTftL848:k57jb_Ilzrg:gIN9vFwzUjOTftL848
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments