dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 12bc248037e83b4bbe6f6ddcdf907ea8eba5dfe9
parent 406953a32260d9672e32d99e6b4495ab611cac7e
Author: hhvn <dev@hhvn.uk>
Date:   Fri, 31 Dec 2021 11:53:34 +0000

.s/b/plumb: remove unzipped files on exit

Diffstat:
M.scripts/bin/plumb | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.scripts/bin/plumb b/.scripts/bin/plumb @@ -90,9 +90,12 @@ fetch(){ $proxy curl $([ "$verbose" != "y" ] && echo -s) "$(echo "$arg" | sed -E 's/]|\[|}|\{/\\&/g')" > "$file" export orig="$arg" export arg="$file" + removelater "$file" +} - [ -z "$exittrap" ] && exittrap=":" - exittrap="$exittrap; rm -rf \"$file\"" +removelater(){ + [ -z "$exittrap" ] && exittrap="$*" + exittrap="$exittrap; rm -rf \"$*\"" trap "$exittrap" EXIT } @@ -177,11 +180,13 @@ do # local files now fmatches "gzip" && isfile && - plumb matchlater 'gunzip < $arg > $arg.new && mv $arg.new $arg' + plumb matchlater 'gunzip < $arg > $arg.new && mv $arg.new $arg' && + removelater "$arg.new" fmatches "zip.*archive" && isfile - plumb matchlater 'unzip -p $arg > $arg.new && mv $arg.new $arg' + plumb matchlater 'unzip -p $arg > $arg.new && mv $arg.new $arg' && + removelater "$arg.new" fmatches "PGP.*public.*key|PGP.*ring" && isfile &&