title: Using if elif fi in shell scripts
body: <p>I'm not sure how to do an <code>if</code> with multiple tests in shell. I'm having trouble writing this script:</p>
  
  <pre><code>echo "You have provided the following arguments $arg1 $arg2 $arg3"
  if [ "$arg1" = "$arg2" &amp;&amp; "$arg1" != "$arg3" ]
  then
      echo "Two of the provided args are equal."
      exit 3
  elif [ $arg1 = $arg2 &amp;&amp; $arg1 = $arg3 ]
  then
      echo "All of the specified args are equal"
      exit 0
  else
      echo "All of the specified args are different"
      exit 4
  fi
  </code></pre>
  
  <p>The problem is I get this error every time:</p>
  
  <blockquote>
    <p>./compare.sh: [: missing `]' command not found</p>
  </blockquote>