title: How to untar all .tar.gz with shell-script?
body: <p>I tried this:</p>
  
  <pre><code>DIR=/path/tar/*.gz
  
  if [ "$(ls -A $DIR 2&gt; /dev/null)" == "" ]; then
    echo "not gz"
  else
    tar -zxvf /path/tar/*.gz -C /path/tar
  fi
  </code></pre>
  
  <p>If the folder has one tar, it works. If the folder has many tar, I get an error.</p>
  
  <p>How can I do this?</p>
  
  <p>I have an idea to run a loop to untar, but I don't know how to solve this problem</p>