From 3b3abe74d21e96c9dc0830d31dc92d7e0f1b4295 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 25 Mar 2024 15:34:59 -0700 Subject: [PATCH] fix bug in `grab` and do the subshell dance --- sh/grab | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sh/grab b/sh/grab index c34495e..46956fa 100644 --- a/sh/grab +++ b/sh/grab @@ -4,7 +4,7 @@ # YES_DASH # YES_ASH -grab() ( ### @- download a file from my site and verify its integrity by its [minisign](https://github.com/jedisct1/minisign/) signature. +__grab() { ### @grab - download a file from my site and verify its integrity by its [minisign](https://github.com/jedisct1/minisign/) signature. [ -z "${ZSH_VERSION}" ] || emulate sh #!/usr/bin/env sh umask 002 @@ -90,11 +90,15 @@ will remove temporary files find -name '*.minisig' -delete || die will return files to original directory -cd "$owd" && find "$t" -type f -exec mv -- {} . \; || die +cd "$owd" || die +find "$t" -type f | while read -r f +do mv -- "$f" . || die +done || exit will remove temporary directory # assuming it's now emptied rmdir "$t" || die trap - INT EXIT -) +} -[ -n "${preload+-}" ] || grab "$@" +grab()(__grab "$@") +[ -n "${preload+-}" ] || __grab "$@"