Я бы использовал python
if ! python -c "exec(\"import platform\nexit ('centos' not in platform.linux_distribution()[0].lower())\")" ; then echo "It is not CentOS distribution, ignoring CentOS setup" exit 0 fi