diff --git a/clean.sh b/clean.sh index 0079fa2..40b8310 100755 --- a/clean.sh +++ b/clean.sh @@ -14,10 +14,12 @@ SRC_DIRS=( printf "This will back up and clean your Neovim directories.\n" printf "Backup suffix to be appended: %s\n\n" "$TAG" -printf "Planned moves (only if source exists):\n" +printf "Plan:\n" for SRC in "${SRC_DIRS[@]}"; do - DEST="${SRC}${TAG}" - printf " %s -> %s\n" "$SRC" "$DEST" + if [ -e "$SRC" ]; then + DEST="${SRC}${TAG}" + printf " %s -> %s\n" "$SRC" "$DEST" + fi done printf "\n" @@ -33,8 +35,6 @@ for SRC in "${SRC_DIRS[@]}"; do DEST="${SRC}${TAG}" printf "Moving %s -> %s\n" "$SRC" "$DEST" mv "$SRC" "$DEST" - else - printf "Skipping missing: %s\n" "$SRC" fi done