From 5c571868071c6252792eee7794f4d680d4941b22 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Thu, 12 Nov 2015 10:35:10 -0800 Subject: [PATCH] Don't ask for confirmation if there are no results. --- dotfiles/zshrc.d/prune-broken-symlinks.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dotfiles/zshrc.d/prune-broken-symlinks.zsh b/dotfiles/zshrc.d/prune-broken-symlinks.zsh index 7127807..73bc530 100644 --- a/dotfiles/zshrc.d/prune-broken-symlinks.zsh +++ b/dotfiles/zshrc.d/prune-broken-symlinks.zsh @@ -14,7 +14,12 @@ prune-broken-symlinks() { DIR=${1:-.} FINDCMD=(find ${DIR} -type l -xtype l) if (($ASK)) ; then - ${FINDCMD} -print + local FILES + FILES=`${FINDCMD} -print` + if [[ "${FILES}" == "" ]] ; then + return 0 + fi + echo ${FILES} echo -n 'Delete these links? [y/n] ' if read -q ; then ${FINDCMD} -delete