title: Bash: how to check if directory exists?
body: <p>I have written following <code>if-else statement</code> to check if <code>directory1</code> or <code>directory2</code> exists or not</p>
  
  <pre><code>if [ -d /opt/directory1 ] || [ -d /opt/directory2 ]; then
   echo "SUCCESS"
  else
   echo "FAil
  fi
  </code></pre>
  
  <p>However, on some servers I am getting an error</p>
  
  <pre><code>[: /opt/directory1: binary operator expected
  </code></pre>
  
  <p>All servers are using <code>bash</code></p>