title: Getting "unary operator expected" in my sh script
body: <p>I’m trying to write a startup script for my service using sh but having trouble with the following line </p>
  
  <pre><code>#!/bin/sh
  …
  if [ `ps --pid $ppid 2&gt; /dev/null | grep -c $ppid 2&gt; /dev/null` -eq '1' ]; then
  </code></pre>
  
  <p>I get the error</p>
  
  <pre><code>Starting jboss-as: /etc/init.d/jboss: line 106: [: -eq: unary operator expected
  </code></pre>
  
  <p>I can’t tell what is wrong with the eq conditional.  Any advice? - Dave</p>