title: unit test bash script function which deletes files older than certain number of days
body: <p>I don't have much experience with bash/shell scripting and just recently started writing some bash scripts with unit tests using Bats framework or libraries. Currently writing a script which needs to delete the files older than certain number of days. Below is the function.</p>
  <pre><code>function deleteFilesOlderThan() {
   echo &quot;Deleting files older than $1 days&quot;
   eval &quot;find ./test-files -mtime +$1 -exec rm {} \;&quot;
  }
  </code></pre>
  <p>Is it possible to unit test the above function as it has complex command? If it is not possible can we rewrite the above function some other way so that it is unit testable. Please advise.</p>