Skip to content

Instantly share code, notes, and snippets.

@abhinavkorpal
Created July 6, 2017 05:47
Show Gist options
  • Save abhinavkorpal/bad6bded5b3b265566e17cd39d16407f to your computer and use it in GitHub Desktop.
Save abhinavkorpal/bad6bded5b3b265566e17cd39d16407f to your computer and use it in GitHub Desktop.
Compress Script
#!/bin/sh
# sed -e 's/^[ \t]*//;s/[ \t]*$//' -e '/^#/d' -e '/^$/d'
if [ -z $1 ]; then exit 0; else true; fi
xz -kf9 $1
printf '#!/bin/sh\nx=`tempfile`;echo ' > ${1}-min
base64 -w 0 ${1}.xz >> ${1}-min
printf '|base64 -d|xz -d>$x && chmod +x $x && $x $@; rm $x' >> ${1}-min
rm -f ${1}.xz
chmod a+x ${1}-min
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment