Conditional Logic

If I want to check to see if a message contains an “error” how would I go about that?

string1="operation was successful"
string2="operation contained an error"
string3="error"
[[ $string2 = *error* ]]; echo $? # this would work but I don't want to hardcode the "error"
[[ $string2 = ?????? ]]; exho $?

Try the following

string1="operation was successful"
string2="operation contained an error"
string3="error"

if [[ "$string2" == *"$string3"* ]]; then echo "it's here"
 fi