diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh index 67b4e7f1d..bf0d13f7c 100644 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/functions/command_mods_remove.sh @@ -27,17 +27,10 @@ fn_mods_remove_init(){ fn_script_log_info "No mods or addons to remove." core_exit.sh fi - # Build installed mods list and display to the user. - installedmodsline=1 - availablemodsremove=() - while [ $installedmodsline -le $installedmodscount ]; do - availablemodsremove+=( "$(sed "${installedmodsline}q;d" "${modslockfilefullpath}" )" ) - echo -e " * \e[36m$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")\e[0m" - let installedmodsline=installedmodsline+1 - done - echo "" + # Displays installed addons to the user + fn_installed_mods_list # Keep prompting as long as the user input doesn't correspond to an available mod - while [[ ! " ${availablemodsremove[@]} " =~ " ${usermodselect} " ]]; do + while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do echo -en "Enter a \e[36mmod\e[0m to \e[31mremove\e[0m (or exit to abort): " read -r usermodselect # Exit if user says exit or abort @@ -46,7 +39,7 @@ fn_mods_remove_init(){ echo "Aborted." core_exit.sh # Supplementary output upon invalid user input - elif [[ ! " ${availablemodsremove[@]} " =~ " ${usermodselect} " ]]; then + elif [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; then fn_print_error2_nl "${usermodselect} is not a valid mod." echo " * Enter a valid mod or input exit to abort." fi