Skip to content

Instantly share code, notes, and snippets.

@Akagi201
Created July 22, 2014 07:16
Show Gist options
  • Save Akagi201/0502dce16dd8918834f0 to your computer and use it in GitHub Desktop.
Save Akagi201/0502dce16dd8918834f0 to your computer and use it in GitHub Desktop.
#!/bin/sh
skip=14
tmpdir=`/bin/mktemp -d ${TMPDIR:-/tmp}/gzexe.XXXXXXXXXX` || exit 1
prog="${tmpdir}/`echo \"$0\" | sed 's|^.*/||'`"
if /usr/bin/tail -n +$skip "$0" | "/bin"/gzip -cd > "$prog"; then
/bin/chmod 700 "$prog"
trap '/bin/rm -rf $tmpdir; exit $res' EXIT
"$prog" ${1+"$@"}; res=$?
else
echo "Cannot decompress $0"
/bin/rm -rf $tmpdir
exit 1
fi; exit $res
‹Ÿ!•Stool.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment