title: How to write if else in one line in shell?
body: <p>I would like to write in one line this:</p>
  
  <pre><code>if [$SERVICESTATEID$ -eq 2]; then echo "CRITICAL"; else echo "OK"; fi
  </code></pre>
  
  <p>So to do a test in my shell I did:</p>
  
  <pre><code>if [2 -eq 3]; then echo "CRITICAL"; else echo "OK"; fi
  </code></pre>
  
  <p>The result is</p>
  
  <pre><code>-bash: [2: command not found
  OK
  </code></pre>
  
  <p>So it doesn't work.</p>