From a222db339d7ce4fa8c99bf0c1b7da18b4b213910 Mon Sep 17 00:00:00 2001 From: Mari Date: Sat, 2 Oct 2021 17:02:38 -0400 Subject: [PATCH] update rmdirs --- zsh/customizations/zsh_aliases.zsh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/zsh/customizations/zsh_aliases.zsh b/zsh/customizations/zsh_aliases.zsh index 07ad2cc..6503f63 100644 --- a/zsh/customizations/zsh_aliases.zsh +++ b/zsh/customizations/zsh_aliases.zsh @@ -33,7 +33,17 @@ alias mv='mv -i' function rmdirs() { - [[ -z $(find $@ -not -type d | tee /dev/stderr | head -n10) ]] && rm -Ir $@ || >&2 echo Files were found, please check again or run rm -Ir manually + RESULT=$(find $@ -not -type d) + if [[ -z $RESULT ]]; then + rm -Ir $@ + else + results=$(wc -l <<<$RESULT) + >&2 echo "$results file(s) were found, please check again or run rm -Ir manually:" + echo $RESULT | head -n10 >&2 + if [[ $results -gt 10 ]]; then + >&2 echo "... additional files elided" + fi + fi } # Use a larger number of KDF rounds and the secure ed25519 key type by default.