title: Bash - dirname: missing operand
body: <p>My pipeline fetches the directory of a <code>terragrunt.hcl</code> file and run a bunch of test against it. I want my bash to execute 2 commands if my <code>if</code> statement is true, if not true jump to the <code>else</code> statement and my <code>else</code> should be do nothing and exit.
  This bash below actually works but I get this error below in the pipeline logs whenever a <code>terragrunt.hcl</code> is not touched. I am assuming something if off on my <code>if</code> statement!</p>
  <p>here is my bash :</p>
  <pre><code>#!/bin/bash
  
  if find . -name &quot;terragrunt.hcl&quot; -print0 | xargs -0 git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA ; then # output only latest terragrunt.hcl commit
     find . -name &quot;terragrunt.hcl&quot; -print0 | xargs -0 git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA | xargs -n 1 dirname | uniq # command 1
     for i in $(find . -name &quot;terragrunt.hcl&quot; -print0 | xargs -0 git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA | xargs -n 1 dirname | uniq); do cd /usr/bin/regula/bin &amp;&amp; ./regula /path/to/$i /usr/bin/regula/lib /path/to/custom-rules; done # command 2
  else 
     :
  fi
  </code></pre>
  <p>Here is the error:</p>
  <pre><code>$ ./compliance_check.sh
  dirname: missing operand
  Try 'dirname --help' for more information.
  dirname: missing operand
  Try 'dirname --help' for more information.
  Cleaning up file based variables
  00:01
  Job succeeded
  </code></pre>
  <p>Please help!!!</p>