Answers:
这是我在Arch论坛上很久以前发现的一颗宝石,在使用它之前,应该拥有7zip和/ unrar或其他工具来处理需要提取的格式。
# File extractor
# usage: extract <file>
extract ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*.snz) snunzip $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
要使用它,必须将其添加到您的文件中,.bash_profile或者.profile在完成后可以使用extract它从命令行解压缩所有类型的档案。语法是extract name-of-archive
你可以用活泼的使用也一样,你需要安装此但它会工作之前。