#!/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
转载于:https://blog.51cto.com/lampit/1932528