title: BASH - If else, Regular expression, OR
body: <p>My bash script is supposed to check if the user inputs two numbers. Each number should be preceded by either a <code>+</code> or a <code>-</code> sign. The first number should be four digits long, and the second number should be five digits long. </p>
  
  <p>No matter what values I enter, the output is always <code>Fail</code></p>
  
  <p>Command-line statement to run the script:</p>
  
  <pre><code>$me add +1234 -12345
  </code></pre>
  
  <p>The script:</p>
  
  <pre><code>#!/bin/bash
  #Script name add
  if [ $1 != [\+\-][0-9][0-9][0-9][0-9] ] || 
     [ $2 != [\+\-][0-9][0-9][0-9][0-9][0-9] ]
    then
      echo Fail
  else    
      echo Success
  fi
  </code></pre>