Shell custom decompression Linux: RedHatEnterpriseLinux5 writes a script named smartzip. sh, which can automatically decompress bzip2, gzip, and zip compressed files: smartzip. shJs code #! /Bin/bashftype & quot; $ (file & quot; $1 & quot;) & quot ;... linux: Red Hat Enterprise Linux 5 writes a file named smartzip. sh script, which can automatically decompress bzip2, gzip, and zip compressed files: smartzip. sh Js code #! /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 to smartzip. sh grants the execution permission: Js code chmod + x smartzip. sh in the same directory, there is a file articles.zip which also gives the file execution permission. Js code chmod + x articles.zip uses the command smartzip to decompress the file Js code. /smartzip. sh articles.zip $1 is the execution result of the string articles.zip:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service