首页 > 代码库 > 批量解压个各种格式后缀的脚本

批量解压个各种格式后缀的脚本

#!/bin/bash


cd /lamp


ls * > ./list.txt


for a in $(cat list.txt)

do

if [[ "$a" =~ "tar" ]]

then

tar -xf $a

elif [[ "$a" =~ "tgz" ]]

then

tar -xf $a

elif [[ "$a" =~ "gz" ]]

then

gunzip $a

elif [[ "$a" =~ "bz" ]]

then 

bunzip2 $a

elif [[ "$a" =~ "zip" ]]

then

unzip $a

else

echo "$a is not a zip file."

fi

done


本文出自 “凌宇的技术博客” 博客,谢绝转载!

批量解压个各种格式后缀的脚本