Linux Shell Based Launcher (FGTLX)

The shell based menu system launched FLight Gear with the options shown will be based on this code below or better code.

(Source : https://bash.cyberciti.biz/guide/Menu_driven_scripts)


#!/bin/bash
# A menu driven shell script sample template 
# https://bash.cyberciti.biz/guide/Menu_driven_scripts
## ----------------------------------
# Step #1: Define variables
# ----------------------------------

 
# ----------------------------------
# Step #2: User defined function
# ----------------------------------
pause(){  read -p "Press [Enter] key to continue..." fackEnterKey
}

one(){   echo "fgfs --aircraft=c172p --enable-auto-coordination --airport=PHNL"
        fgfs --aircraft=c172p --enable-auto-coordination --airport=PHNL
        pause
}
 
two(){  echo "  fgfs --aircraft = c172pN1234 --enable-auto-coordination --airport=PHMK"
          fgfs --aircraft=c172pN1234 --enable-auto-coordination --airport=PHMK
        pause
}

three(){  echo "fgfs --aircraft = UFO, default location"
        fgfs --aircraft=UFO
        pause
}

four(){  echo "--enable-auto-coordination --airport=PHNL"
        fgfs --aircraft=c172pN1234 --enable-auto-coordination --airport=PHNL --timeofday=noon
        pause
}

five(){  echo "Add Launch String"
        echo "Add Launch String"
        pause
}

six(){  echo "Add Launch String"
        echo "Add Launch String"
        pause
}

 
# function to display menus
show_menus() {
 clear
 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 
 echo " FGTLX FG Text Based Launcher for Linux"
 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
 echo "1. Cessna 172p N 1234 Autocoordination, PHNL, Parking"
 echo "2. Cessna 172p Autocoordination, PHMK Parking"
    echo "3. UFO"
 echo "4. Cessna 172p N 1234 Autocoordination, Noon"
    echo "5. Cessna 172p Autocoordination, PHNL"
 echo "6. UFO"
 echo "7. Exit"
}

read_options(){
 local choice
 read -p "Enter choice [ 1 - 3] " choice
 case $choice in
  1) one ;;
  2) two ;;
        3) three ;;
  4) four ;;
        5) five ;;
  6) six ;;
  7) exit 0;;
  
 esac
}
 

# -----------------------------------
# Step #4: Main logic - infinite loop
# ------------------------------------
while true
do
 
 show_menus
 read_options
done