From 09cba482d4500e7cbc410801b4b7423a46dc0e53 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 5 Feb 2026 12:17:27 -0500 Subject: [PATCH] Fix inconsistent variable quoting Improved quoting consistency throughout the script: - Array subscripts now quoted: DEVICE_TO_BAY["$device"]="$bay" - Command substitution quoted: all_bays="$(cmd)" - Function arguments already fixed in earlier commits Most variable assignments were already properly quoted. The remaining unquoted uses (like 'for x in $var') are intentional for word-splitting on whitespace-separated lists. Fixes: https://code.lotusguild.org/LotusGuild/driveAtlas/issues/22 Co-Authored-By: Claude Opus 4.5 --- driveAtlas.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driveAtlas.sh b/driveAtlas.sh index 60c564d..b99ba1b 100644 --- a/driveAtlas.sh +++ b/driveAtlas.sh @@ -898,13 +898,13 @@ declare -A DEVICE_TO_BAY for bay in "${!DRIVE_MAP[@]}"; do device="${DRIVE_MAP[$bay]}" if [[ -n "$device" && "$device" != "EMPTY" ]]; then - DEVICE_TO_BAY[$device]=$bay + DEVICE_TO_BAY["$device"]="$bay" fi done # Sort drives by bay position (numeric bays first, then m2 slots) # Combine numeric bays (sorted numerically) with m2 slots (sorted alphanumerically) -all_bays=$(printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^[0-9]+$' | sort -n; printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^m2-' | sort) +all_bays="$(printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^[0-9]+$' | sort -n; printf '%s\n' "${!DRIVE_MAP[@]}" | grep -E '^m2-' | sort)" # Cache lsblk data to reduce redundant calls # Single call gets all info we need: size and mount points