DIFF.BLOG
New
Following
Discover
Jobs
More
Suggest a blog
Upvotes plugin
Report bug
Contact
About
Sign up  
tar ballが .gzだろうが.xzだろうが.zstだろうが解凍してやる!
1
·
·
June 14, 2022, 11:38 a.m.
Summary
TL;DR #!/bin/bash untar_by_file_type() { if [[ "$1" == "application/x-tar" ]]; then tar -xvf "$2" elif [[ "$1" == "application/gzip" ]]; then tar -zxvf "$2" elif [[ "$1" == "application/x-xz" ]]; then tar -Jxvf "$2" elif [[ "$1" == "application/zstd" ]]; then tar --use-compress-program unzstd -xvf "$2" fi } untar() { if [[ "$1" == "" ]]; then echo "usage: untar <archive-filename>" exit 1 fi untar_by_file_type "$(file -b --mime-type "$1")" "$1"...
Read full post on chantsune.github.io →
Submit
AUTHOR
RECENT POSTS FROM THE AUTHOR