#!/bin/sh if [ "$1" == "-d" ]; then shift tail -n +11 "$@" | zstd -do "$@"~ && mv "$@"~ "$@" chmod +x "$@" else cat > "$@"~ << 'EOF' #!/bin/sh dir=`dirname $0` out=`mktemp -t .zzXXXX` tail -n +11 $0 | zstd -cd > $out chmod +x $out ln -s $out $dir trap "res=$?" 0 1 2 3 5 10 13 15 $dir/`basename $out` $@ rm $out $dir/`basename $out` exit $res EOF zstd --ultra -22 "$@" rm "$@" cat "$@"~ "$@".zst > "$@" rm "$@".zst "$@~" chmod +x "$@" fi