Test if a given string conforms the specified glob/regex

[[

  • Check file types and compare values.
    Returns 0 if the condition evaluates to true, 1 if it evaluates to false.
    More information: <https://www.gnu.org/software/bash/manual/bash.html#index-_005b_005b>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

[[ ${{variable}} {{==|=~}} {{pattern}} ]]

click the source code to copy