From b4161710175c9c00114ee7c114d4414f985d5dd2 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 5 Jul 2024 21:06:50 -0700 Subject: [PATCH] prevent `dedupe` from echoing the new CWD --- sh/dedupe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/dedupe b/sh/dedupe index 1c568fd..78ade4f 100644 --- a/sh/dedupe +++ b/sh/dedupe @@ -37,8 +37,8 @@ while o="${1#-}" && [ "${#o}" != "${#1}" ] && shift esac; done && { [ -d /tmp ] || die 72 "/tmp must be mounted" ;} && { [ $# -ge 2 ] || die 64 'expected at least 2 arguments' ;} && -D="$(readlink -f "$2")" && CDPATH= cd -- "$1" && shift 2 && T="$(mktemp -d)" && -t="$T/sums" && { [ $# -eq 0 ] || sha256sum >"$t" "$@" ;} && +unset CDPATH && D="$(readlink -f "$2")" && cd -- "$1" && shift 2 && +T="$(mktemp -d)" && t="$T/sums" && { [ $# -eq 0 ] || sha256sum >"$t" "$@" ;} && find ! -type d ! -type s -exec sha256sum -- {} + >>"$t~" && sort -k2 <"$t~" >>"$t" && awk -v D="$D" -v h="$h" -F' ' "$program" <"$t"; x=$? ! [ -d "$t" ] || rm -r "$t" && [ $x = 0 ] || die $x 'exiting after failure'