title: Unix - Find command with tar and gz works well from command line but not working on Script
body: <p>When i use this command on command line with hard coded values for the parameters $dir,$year,$month it works very well and creates the gzip file. I checked the contents of the gz file and i see the desired results.</p>
  
  <pre><code>find $dir -name '*_$year-$month-*' -type f -print | \
  xargs tar -zvcf $dir/log.$year-$month.tar.gz
  </code></pre>
  
  <p>But when i embed this in a shell script and run, it won't run and gives me this error.</p>
  
  <p><code>tar: Cowardly refusing to create an empty archive</code></p>