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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user