Don't ask for confirmation if there are no results.

This commit is contained in:
David Tomaschik
2015-11-12 10:35:10 -08:00
parent 97d0f2f1d0
commit 5c57186807

View File

@@ -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