Issue
I have a string
$VAR="I-UAT";
in my shell script code. I need a conditional statement to check if "UAT"
is present in that string.
What command should I use to get either true or false boolean as output? Or is there any other way of checking it?
Solution
What shell? Using bash:
if [[ "$VAR" =~ "UAT" ]]; then
echo "matched"
else
echo "didn't match"
fi
Answered By - Andrew Clark Answer Checked By - Robin (WPSolving Admin)