Linux shell unzip和tar 批量解压文件

#!/bin/sh

UNTAR="tar -xvf "

#unzip all zip files
function unzip_all_file()
{
    for i in *.zip
    do
        unzip $i 
    done
}

#untar all tar.gz files
function untar_all_file()
{
    for i in *.tar.gz
    do
        $UNTAR $i
    done
}

case $1 in
    unzip)
        unzip_all_file
        ;;
    untar)
        untar_all_file
        ;;
    
esac

 

posted @ 2019-04-14 10:20  茫茫明明  阅读(1182)  评论(0编辑  收藏  举报