firstly I had very simple script like this
#!/bin/sh
if cat /etc/redhat-release | grep -q 'AlmaLinux'; then
echo "your system is supported"
MY SCRIPT HERE
else
echo "Unsupported OS"
exit0;
fi
and it works but I want to add another correct value that will also return "your system is supported" and let me pass the script to go further
so for example if file /etc/redhat-release will contain AlmaLinux or Rockylinux 8 it will work for both AlmaLinux and Rockylinux but if it will contain Centos 6 it will not go further
I tried something along this:
#!/bin/sh
if cat '/etc/redhat-release' | grep -q 'AlmaLinux'|| | grep -q 'RockyLinux 8'; then
echo "your system is supported"
else
echo "Unsupported OS"
fi
but it gives me an error and I am even not sure if this is a right syntax.
Can anyone help me?
3
Answers
Maybe by using a regex pattern?
Try this:
Other perfectly valid detection: