title: Bash Unary Operator Expected
body: <p>Okay, so within my script (this is my first time working with Bash) I am being met with two unary operator expected errors. The code itself is actually working fine, but it's presenting me with these errors at runtime:</p>
  <blockquote>
  <p>[: !=: unary operator expected</p>
  </blockquote>
  <p>For the line:</p>
  <pre><code>if [ ${netmask[1]} != &quot;&quot; ]; do
  </code></pre>
  <p>So for the first error, it's thrown when <code>${netmask[1]}</code> is <code>&quot;&quot;</code> (<code>null</code>). I have tried multiple ideas and still can't get it to work without returning that error in the process.</p>
  <hr/>
  <p>I solved it by adding quotation marks (grrr)</p>
  <pre><code>if [ &quot;${netmask[1]}&quot; != &quot;&quot; ]; do
  </code></pre>