Reputation: 425
Given the following code:
template=*.ord
if [[ ${template} == 1.ord ]]; then
echo YES
fi
I want to get YES
, but I don't get it.
How can I fix it so that it's will match the pattern to 1.ord
(and not the value of template
)?
Upvotes: 0
Views: 57
Reputation: 361565
Flip the arguments. The pattern needs to be on the right-hand side, unquoted.
if [[ 1.ord == ${template} ]]; then
echo YES
fi
Upvotes: 3