Given a string and a hash returned by
openssl, why using
== doesn't match them correctly but
Background question: How can I force a script to use more resources?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
The binary operator, ‘=~’, has the same precedence as ‘==’ and ‘!=’. When it is used, the string to the right of the operator is considered an extended regular expression and matched accordingly (as in regex3)). The return value is 0 if the string matches the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the conditional expression’s return value is 2.
Hence your comparing for equality versus for a regular expression match.