title: Using wildcards in bash if statement
body: <p>I wrote the following code in the bash shell. It's supposed to take the positional parameter and, if it starts with a dash &quot;-&quot;, print an error message. For some reason the <code>if</code> statement always gets skipped. It only works if I literally input <code>-*</code>.</p>
  <p>I get the impression that the fix has something to do with the <code>$</code>.</p>
  <pre><code>EXECNAME=$1
  if [ &quot;$EXECNAME&quot; = &quot;-*&quot; ]; then
         echo &quot;error: invalid executable name&quot;
  fi
  </code></pre>