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
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
# === DATENSTRUKTUREN ===
|
# === DATENSTRUKTUREN ===
|
||||||
declare -a MISSION_OPTIONS
|
# Arrays für Missionen (Bash 3.2+ kompatibel)
|
||||||
declare -A MISSION_MAP
|
MISSION_OPTIONS=()
|
||||||
declare -a MISSION_SCRIPTS
|
MISSION_SCRIPTS=()
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# FUNKTIONEN
|
# FUNKTIONEN
|
||||||
@@ -56,9 +56,12 @@ load_missions() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${BLUE}🔍 Lade Missionen aus: ${search_dir}${NC}"
|
echo -e "${BLUE}🔍 Lade Missionen aus: ${search_dir}${NC}"
|
||||||
|
|
||||||
# Alle .sh Dateien finden
|
# Alle .sh Dateien finden (Bash 3.2+ kompatibel)
|
||||||
mapfile -t MISSION_SCRIPTS < <(find "$search_dir" -maxdepth 1 -type f -name "*.sh" | sort)
|
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
|
if [[ ${#MISSION_SCRIPTS[@]} -eq 0 ]]; then
|
||||||
echo "❗ Keine Missionen gefunden!"
|
echo "❗ Keine Missionen gefunden!"
|
||||||
@@ -86,9 +89,6 @@ load_missions() {
|
|||||||
# Fallback ohne Metadaten
|
# Fallback ohne Metadaten
|
||||||
MISSION_OPTIONS+=("🛸 ${mission_name}")
|
MISSION_OPTIONS+=("🛸 ${mission_name}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mapping für späteren Zugriff
|
|
||||||
MISSION_MAP["$mission_name"]="$mission_file"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "${GREEN}✅ ${#MISSION_OPTIONS[@]} Missionen geladen.${NC}"
|
echo -e "${GREEN}✅ ${#MISSION_OPTIONS[@]} Missionen geladen.${NC}"
|
||||||
|
|||||||
Reference in New Issue
Block a user