title: Check if array is empty in bash
body: <p>I am trying to see if an array is empty in bash</p>
  <pre class="lang-sh prettyprint-override"><code>key=[]
  key1=[&quot;2014&quot;]
  </code></pre>
  <p>I have tried following ways:</p>
  <pre class="lang-sh prettyprint-override"><code>[[ -z &quot;$key&quot; ]] &amp;&amp; echo &quot;empty&quot; || echo &quot;not Empty&quot; 
  [[ -z &quot;$key1&quot; ]] &amp;&amp; echo &quot;empty&quot; || echo &quot;not Empty&quot;
  </code></pre>
  <p>Both return 'not Empty'</p>
  <pre class="lang-sh prettyprint-override"><code>[[ $key==[] ]] &amp;&amp; echo &quot;empty&quot; || echo &quot;not Empty&quot;
  [[ $key1==[] ]] &amp;&amp; echo &quot;empty&quot; || echo &quot;not Empty&quot;
  </code></pre>
  <p>Both return 'empty'.</p>