Fix: Make mission selector compatible with Bash 3.2+
- Replace associative array with indexed arrays - Replace mapfile with while-read loop - Now works on macOS (Bash 3.2) and Linux (all versions) - Linux first, but cross-platform compatible
This commit is contained in:
@@ -21,9 +21,9 @@ YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# === DATENSTRUKTUREN ===
|
||||
declare -a MISSION_OPTIONS
|
||||
declare -A MISSION_MAP
|
||||
declare -a MISSION_SCRIPTS
|
||||
# Arrays für Missionen (Bash 3.2+ kompatibel)
|
||||
MISSION_OPTIONS=()
|
||||
MISSION_SCRIPTS=()
|
||||
|
||||
# ============================================================
|
||||
# FUNKTIONEN
|
||||
@@ -56,9 +56,12 @@ load_missions() {
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}🔍 Lade Missionen aus: ${search_dir}${NC}"
|
||||
|
||||
# Alle .sh Dateien finden
|
||||
mapfile -t MISSION_SCRIPTS < <(find "$search_dir" -maxdepth 1 -type f -name "*.sh" | sort)
|
||||
|
||||
# Alle .sh Dateien finden (Bash 3.2+ kompatibel)
|
||||
MISSION_SCRIPTS=()
|
||||
while IFS= read -r file; do
|
||||
[[ -n "$file" ]] && MISSION_SCRIPTS+=("$file")
|
||||
done < <(find "$search_dir" -maxdepth 1 -type f -name "*.sh" | sort)
|
||||
|
||||
if [[ ${#MISSION_SCRIPTS[@]} -eq 0 ]]; then
|
||||
echo "❗ Keine Missionen gefunden!"
|
||||
@@ -86,9 +89,6 @@ load_missions() {
|
||||
# Fallback ohne Metadaten
|
||||
MISSION_OPTIONS+=("🛸 ${mission_name}")
|
||||
fi
|
||||
|
||||
# Mapping für späteren Zugriff
|
||||
MISSION_MAP["$mission_name"]="$mission_file"
|
||||
done
|
||||
|
||||
echo -e "${GREEN}✅ ${#MISSION_OPTIONS[@]} Missionen geladen.${NC}"
|
||||
|
||||
Reference in New Issue
Block a user