title: Checking the success of a command in a bash `if [ .. ]` statement
body: <p>I am trying to automate our application backup. Part of the process is to check the exit status of <code>egrep</code> in an <code>if</code> statement:</p>
  
  <pre><code>if [ ! -f /opt/apps/SiteScope_backup/sitescope_configuration.zip ] ||
     [ egrep -i -q "error|warning|fatal|missing|critical" "$File" ]
  then 
    echo "testing"
  fi
  </code></pre>
  
  <p>I expected it to output <code>testing</code> because the file exists and <code>egrep</code> returns success, but instead I'm getting an error:</p>
  
  <pre><code>-bash: [: too many arguments
  </code></pre>
  
  <p>I tried with all kinds of syntax - additional brackets, quotes etc but error still persists.</p>
  
  <p>Please help me in understanding where I am going wrong.</p>