title: Bash: String contains hyphen
body: <p>I am trying to see if string1 contains another string2. I do this in this manner:</p>
  
  <pre><code>a=$(tempfile)
  echo "eafg" &gt; $a
  
  if [[ $a == *e* ]]
  then
     echo "contains"
  fi
  </code></pre>
  
  <p>Now I try to see if a string contains a hyphen:</p>
  
  <pre><code>a=$(tempfile)    
  echo "22:00:00-02:00" &gt; $a
  
  if [ $a == *-* ]
  then
     echo "contains"
  fi
  </code></pre>
  
  <p>It doesn't work. I also tried:</p>
  
  <pre><code>if [ $a == *--* ]
  if [ $a == *---* ]
  if [[ $a == *-* ]]
  if [[ $a == *--* ]]
  if [[ $a == *---* ]]
  </code></pre>
  
  <p>With no success...</p>
  
  <p>Thanks in advance</p>