文章目录
#!/bin/bash
function read_dir(){
for file in `ls -a $1`
do
if [ -d $1'/'$file ];then
if [[ $file != '.' && $file != '..' ]];then
read_dir $1'/'$file
fi
else
if [[ $file =~ \*.zip$ ]];then
unzip -n -d $1 $1'/'$file
elif [[ $file =~ [\*.tar.gz$] || [\*.tar$] ]];then
tar -zxvf $1'/'$file
elif [[ $file =~ [\*.tar.bz2$] ]];then
tar -jxvf $1'/'$file
fi
fi
done
}
read_dir `pwd`
参考链接1:Linux下 IF 多条件判断