Last active
July 2, 2018 08:32
-
-
Save anon-hui/937687aee391b0a2209da20b53550226 to your computer and use it in GitHub Desktop.
compress file using best command between, gzip, gzip -9, bzip2, bzip2 -9, lzma, lzma -9. (bash shell) Usage "$ . zip.sh filename". th_TH:บีบอัดไฟล์โดยเลือกคำสั่งที่ดีที่สุดระหว่าง, gzip, gzip -9, bzip2, bzip2 -9, lzma, lzma -9.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. /dev/null | |
set -- "$1" "`wc -c -- "$1" | tee /dev/stderr | awk '{print$1}'`" '' : | |
echo "${@:2}" ; | |
set -- "$1" "$2" "`gzip -c -- "$1" | wc -c`" "${@:4}" | |
echo "${@:2}" ; (( "$3" < "$2" )) && set -- "$1" "$3" '' gzip | |
set -- "$1" "$2" "`gzip -c -9 -- "$1" | wc -c`" "${@:4}" | |
echo "${@:2}" ; (( "$3" < "$2" )) && set -- "$1" "$3" '' gzip -9 | |
set -- "$1" "$2" "`bzip2 -c -- "$1" | wc -c`" "${@:4}" | |
echo "${@:2}" ; (( "$3" < "$2" )) && set -- "$1" "$3" '' bzip2 | |
set -- "$1" "$2" "`bzip2 -c -9 -- "$1" | wc -c`" "${@:4}" | |
echo "${@:2}" ; (( "$3" < "$2" )) && set -- "$1" "$3" '' bzip2 -9 | |
set -- "$1" "$2" "`lzma -c -- "$1" | wc -c`" "${@:4}" | |
echo "${@:2}" ; (( "$3" < "$2" )) && set -- "$1" "$3" '' lzma | |
set -- "$1" "$2" "`lzma -c -9 -- "$1" | wc -c`" "${@:4}" | |
echo "${@:2}" ; (( "$3" < "$2" )) && set -- "$1" "$3" '' lzma -9 | |
echo "${@:2}" ; | |
set -- "${@:4}" -- "$1" | |
echo "$@" ; | |
"$@" | |
. /dev/null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://m.facebook.com/story.php?story_fbid=10156414058936192&id=705691191 <-- more description in th_TH language