Suppose I have the following Bash snippet:
if [[ "$foo" == *"$bar"* ]] ; then
echo 'condition is true'
fi
In English, you might describe the above code with: if bar is a substring of foo then...
However, how come when we switch the sides of the condition, we don't get the same results?
if [[ *"$bar"* == "$foo" ]] ; then
echo 'condition is true'
fi
Perhaps I have a misunderstanding of when the wildcard is evaluated?