You're setting release8 to the string "
cut -c22 /etc/redhat-release" instead of evaluating it like you do for the variable one line previous.
Using
Bash's -x mode should make this obvious when you run the script.
Also, grabbing the 22nd character of every line doesn't seem like a great way to identify version.
Do those OSes not use
/etc/os-release, where you can simply grab the value of the VERSION_ID line, e.g.
Code:
grep -oP '(?<=VERSION_ID=")\d+' /etc/os-release