From 693c72b89a1fa47162fe928e9cb4a2f15d916b1f Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Tue, 16 Apr 2024 17:24:58 +0200 Subject: [PATCH] only move if the path contains a space --- scripts/normalize-spaces.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/normalize-spaces.sh b/scripts/normalize-spaces.sh index e1b3019de..9eddda413 100755 --- a/scripts/normalize-spaces.sh +++ b/scripts/normalize-spaces.sh @@ -7,10 +7,13 @@ set -euo pipefail ROOT_DIR="${1:-}" if [ -z "$ROOT_DIR" ]; then - echo "Usage: $0 " - exit 1 + echo "Usage: $0 " + exit 1 fi find "$ROOT_DIR" -type f -name '*' -print0 | while IFS= read -r -d '' file; do - mv -v "$file" "$(echo "$file" | tr ' ' '+')" + new_file="$(echo "$file" | tr ' ' '+')" + if [[ "$file" != "$new_file" ]]; then + mv -v "$file" "$new_file" + fi done