From 48415576fa5b52a61490cd982ce3814fafa665f9 2020-07-06 16:05:28 From: Branko Majic <branko@majic.rs> Date: 2020-07-06 16:05:28 Subject: [PATCH] Noticket: [factorio_manager.sh] Do not use bracket expansion for arithmetic tests and operations. --- diff --git a/games/factorio_manager.sh b/games/factorio_manager.sh index 92365e61bf8ac0f0b4be422413b7248eeef9b8dc..df505686f2ed1f54712b191eeb17a7425e581d5b 100755 --- a/games/factorio_manager.sh +++ b/games/factorio_manager.sh @@ -234,7 +234,7 @@ EOF # Set-up colours for message printing if we're not piping and terminal is # capable of outputting the colors. _color_terminal=$(tput colors 2>&1) -if [[ -t 1 ]] && (( ${_color_terminal} > 0 )); then +if [[ -t 1 ]] && (( _color_terminal > 0 )); then _text_black=$(tput setaf 0) _text_red=$(tput setaf 1) _text_green=$(tput setaf 2) @@ -1075,7 +1075,7 @@ function select_factorio_version() { read -r -e -p "Please specify what version you would like to use (enter for $default_marker): " selected_option [[ -z $selected_option ]] && selected_option="$default_option" - if [[ $selected_option =~ ^[[:digit:]]+$ ]] && (( $selected_option >= 1 && $selected_option <= ${#game_versions_available[@]} )); then + if [[ $selected_option =~ ^[[:digit:]]+$ ]] && (( selected_option >= 1 && selected_option <= ${#game_versions_available[@]} )); then game_version_selected="${game_versions_available[$selected_option-1]}" else error "Invalid option selected, please try again." @@ -1179,7 +1179,7 @@ while getopts "qdvh" opt; do esac done i=$OPTIND -shift $(($i-1)) +shift $((i-1)) # Make sure the manager home directory exists. if [[ ! -e $manager_directory ]]; then @@ -1218,7 +1218,7 @@ if [[ $command == set-game-dir ]]; then fi done - if (( $factorio_versions_found == 0 )); then + if (( factorio_versions_found == 0 )); then error "Could not locate any Factorio installations under: $game_installations_directory_target" exit "$ERROR_GENERAL"