#!/bin/bash
# 概要文件类型自动解压
ftype=`file “$1″`
case “$ftype” in
“$1: Zip archive”*)
if [ -z “$2” ]; then
unzip “$1”
else
unzip “$1” -d “$2”
fi
;;
“$1: gzip compressed”*)
if [ -z “$2” ]; then
tar -zxvf “$1”
else
tar -zxvf “$1” -C “$2”
fi
;;
“$1: bzip2 compressed”*)
if [ -z “$2” ]; then
tar -jxvf “$1”
else
tar -jxvf “$1” -C “$2”
fi
;;
*) echo “File $1 can not be uncompressed with smartzip”;;
esac
Linux Smart 解压文件
转载请注明出处:服务器评测 » Linux Smart 解压文件