2022-03-25 22:52:40 +00:00
|
|
|
#!/bin/sh
|
2022-04-15 18:05:20 +00:00
|
|
|
set -e # exit on failure
|
|
|
|
IFS=$(printf '\n\t') # smarter ifs
|
2022-04-16 23:21:07 +00:00
|
|
|
[ "$1" = "-d" ] && tail -n+10 "$2" | zstd -cd | ifne sponge "$2" && exit
|
|
|
|
[ "$1" = "-p" ] && p="$2" && shift 2 # save prefix if present
|
|
|
|
{ cat << 'EOF';zstdmt -c19 "$@";} |sed "2s/$/${1##*.})/;7s/^/$p /"| ifne sponge "$1"
|
|
|
|
#!/bin/sh
|
|
|
|
dir=$(dirname "$0") out=$(mktemp -t .zzXXXX.
|
|
|
|
tail -n+10 "$0" | zstd -cd > "$out"
|
2022-03-25 22:52:40 +00:00
|
|
|
chmod +x "$out"
|
|
|
|
ln -s "$out" "$dir"
|
|
|
|
trap "res=$?" 0 1 2 3 5 10 13 15
|
2022-04-15 18:05:20 +00:00
|
|
|
"$dir/$(basename "$out")" "$@"
|
|
|
|
rm "$out" "$dir/$(basename "$out")"
|
2022-03-25 22:52:40 +00:00
|
|
|
exit $res
|
|
|
|
EOF
|