一口氣解壓縮目錄底下的所有封裝壓縮檔(*.tar.gz)

如果想一次把目錄底下的.tar.gz或.tar.?z等封裝壓縮檔解壓縮,直接這樣做會出問題:
tar -xvf *.tar.gz

螢幕就會開始跳:

tar: a.tar.gz: Not found in archive
tar: b.tar.gz: Not found in archive
tar: c.tar.gz: Not found in archive
tar: d.tar.gz: Not found in archive
tar: e.tar.gz: Not found in archive
tar: Error exit delayed from previous errors.

結果是要這樣才行:

for a in `ls -1 *.tar.gz`; do tar -xvf $a; done