bash – check if a string in a variable

if you use
#! /bin/zsh

$MYVAR=”Hello world”


if [[ $MYVAR == *”hello”*]] then
echo “FOUND”
fi

If we don’t use #! /bin/zsh

$MYVAR=”Hello world”
if [[ $MYVAR == *”hello”*]]; then
echo “FOUND”
fi

Leave a Reply

Your email address will not be published. Required fields are marked *