Welcome 微信登录

首页 / 操作系统 / Linux / Linux Smart 解压文件

#!/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-dpkg软件包和APT软件包管理操作Ubuntu 主目录下 .bashrc 文件备份相关资讯      Linux命令 
  • 48 字节命令可令 Linux 系统当机!  (今 07:55)
  • 在Linux笔记本上执行这句命令能致  (02月02日)
  • .NET开发必会的Linux命令  (12/20/2015 10:32:03)
  • 运维工程师必会的109个Linux命令  (03月09日)
  • 有趣的Linux命令行:随机输出唐诗  (12/28/2015 20:14:23)
  • 10 个 Linux 中的 passwd 命令示例  (10/29/2015 10:14:30)
本文评论 查看全部评论 (0)
表情: 姓名: 字数