多重压缩
Uncompress multiple .zip .gz or .bz2 . .zip for file in *.zip; do unzip "${file}"; done .gz gunzip *.gz .bz2 bunzip2 *.bz2 tar.gz for file in *.tar.gz; do tar zxf "${file}"; done tar.bz2 for file in *.tar.bz2; do tar jxf "${file}"; done Shell script usageIf you use one of the snippets that uses a for loop in a script with an arbitrary number of archives, you may want to set the shell to use "nullglobs". For instance, normally *.tar.gz will evaluate to *.tar.gz when no files were found that match this wildcard, rather than evaluating to an empty string. As a result ‘tar‘ is executed with this string as a parameter. To avoid this, you can request that the shell uses nullglobs with: shopt -s nullglob If no matches were found, the shell will return an empty string, and the for loop is terminated. TipsAndTricks/UncompressMultipleFiles (2007-06-07 18:23:16由RalphAngenendt编辑) |
|