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: #22

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 12:17:27 -05:00
parent 11fc60b38b
commit 09cba482d4

View File

@@ -898,13 +898,13 @@ declare -A DEVICE_TO_BAY
for bay in "${!DRIVE_MAP[@]}"; do for bay in "${!DRIVE_MAP[@]}"; do
device="${DRIVE_MAP[$bay]}" device="${DRIVE_MAP[$bay]}"
if [[ -n "$device" && "$device" != "EMPTY" ]]; then if [[ -n "$device" && "$device" != "EMPTY" ]]; then
DEVICE_TO_BAY[$device]=$bay DEVICE_TO_BAY["$device"]="$bay"
fi fi
done done
# Sort drives by bay position (numeric bays first, then m2 slots) # Sort drives by bay position (numeric bays first, then m2 slots)
# Combine numeric bays (sorted numerically) with m2 slots (sorted alphanumerically) # 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 # Cache lsblk data to reduce redundant calls
# Single call gets all info we need: size and mount points # Single call gets all info we need: size and mount points