title: IF statement in script and in a single command line
body: <p>My script below checks for the instance of opened window in X server and it prints some info in the terminal depending on the state.</p>
  
  <pre><code>#!/bin/bash
  if [[ -z $(xwininfo -tree -root | grep whatsapp | grep chromium) ]]
  then
          echo "IT DOES NOT EXIST";
  else
          echo "IT EXIST";
  fi
  </code></pre>
  
  <p>When I try to rewrite this into a one line terminal command I do it like this:</p>
  
  <pre><code>if -z $(xwininfo -tree -root | grep whatsapp | grep chromium); then echo "IT DOES NOT EXIST"; else echo "IT EXIST"; fi
  </code></pre>
  
  <p>this returns error and a wrong state... </p>
  
  <pre><code>bash: -z: command not found
  IT EXISTS
  </code></pre>
  
  <p>Does anyone have any advice? I tried asking the <a href="https://www.shellcheck.net/" rel="nofollow">ShellCheck</a> but it says I have everything in order...</p>