title: Can fish shell do wildcard globbing in an if statement?
body: <p>I'm having trouble understanding whether I can use wildcard globbing in an if statement in fish. This switch/case works as expected:</p>
  
  <pre><code># correctly echos macOS on macOS
  switch "$OSTYPE"
      case 'darwin*'
          echo 'macOS'
      case '*'
          echo 'not macOS'
  end
  </code></pre>
  
  <p>However, I cannot get an if statement version of the same thing to work.</p>
  
  <pre><code># doesn't work - prints 'not macOS' on macOS
  if [ "$OSTYPE" = 'darwin*' ]
      echo 'macOS'
  else
      echo 'not macOS'
  end
  </code></pre>
  
  <p>In zsh/bash you can do something like this:</p>
  
  <p><code>[[ $OSTYPE == darwin* ]] &amp;&amp; echo 'macOS' || echo 'not macOS'</code></p>
  
  <p>Or, more verbosely,</p>
  
  <pre><code>if [[ $OSTYPE == darwin* ]]
    then echo 'macOS'
    else echo 'not macOS'
  fi
  </code></pre>
  
  <p>My question is, does fish support wildcard globbing against a variable in <code>if</code> statements? Am I doing this wrong? I cannot find an example in the fish docs that tells me either way.</p>
  
  <p><strong><em>NOTE</strong>: I'm not asking about checking <code>$OSTYPE</code> in fish. <a href="https://stackoverflow.com/questions/26258244/is-there-a-way-to-detect-os-in-fish-shell-akin-to-the-ostype-variable-in-bash">I know there are better ways to do that</a>. My question is limited strictly to whether it is possible to do wildcard globbing in an <code>if</code> statement in fish.</em></p>