shell编程笔记四:case in

#!/bin/bash

ftype="$(file "$1")"

case "$ftype" in
"$1: Zip archive"*)
unzip "$1";;
"$1: gzip compressed"*)
gunzip "$1";;
"$1: bzip2 compressed"*)
bunzip2 "$1";;
*) echo "File $1 can not be uncompressed with smartzip";;
esac

posted @ 2013-05-03 16:24  践道者  阅读(269)  评论(0编辑  收藏  举报