From 7190b2c546e8bee63d16ce87f580de41882a41ad Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Wed, 2 Feb 2022 17:06:01 -0800 Subject: [PATCH] Don't attempt to shred missing files `shred` can apparently fail if a file is missing; so don't bother to `shred` if the file doesn't exist. --- lib/common.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/common.sh b/lib/common.sh index 8139843..043b219 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -68,7 +68,11 @@ fi # Figure out the best way to securely delete something if [[ -n "$(which shred 2>/dev/null)" ]]; then function secure_delete() { - shred -u "$*" + for f in "$@"; do + if [[ -e "${f}" ]]; then + shred -u "${f}" + fi + done } elif [[ "$(uname)" == "Darwin" ]] || [[ "$(uname)" == *BSD ]]; then function secure_delete() {