首页 > 其他 > 详细

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

时间:2017-06-06 10:18:01      阅读:202      评论:0      收藏:0      [点我收藏+]

#!/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


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

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

原文:http://lampit.blog.51cto.com/12958178/1932528

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!