-
What is the operator
=~
called?I’m not sure it has a name. The bash documentation just calls it the
=~
operator. -
Is it only used to compare the right side against the left side?
The right side is considered an extended regular expression. If the left side matches, the operator returns
0
, and1
otherwise. -
Why are double square brackets required when running a test?
Because
=~
is an operator of the[[ expression ]]
compound command.