diff --git a/bash_it.sh b/bash_it.sh index 19a26ed965..ae98c1fcb4 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -1,7 +1,14 @@ #!/usr/bin/env bash # shellcheck source-path=SCRIPTDIR/lib source-path=SCRIPTDIR/scripts # shellcheck disable=SC2034 -# + +# Requires bash 3.2+ to install and run +# Skip loading if bash version is too old +if [[ "${BASH_VERSINFO[0]-}" -lt 3 ]] || [[ "${BASH_VERSINFO[0]-}" -eq 3 && "${BASH_VERSINFO[1]}" -lt 2 ]]; then + echo "sorry, but the minimum version of BASH supported by bash_it is 3.2, consider upgrading?" >&2 + return 1 +fi + # Initialize Bash It BASH_IT_LOG_PREFIX="core: main: " : "${BASH_IT:=${BASH_SOURCE%/*}}" diff --git a/install.sh b/install.sh index a99993e4ef..2732b10aa2 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash # bash-it installer +# Requires bash 3.2+ to install and run +# Skip loading if bash version is too old +if [[ "${BASH_VERSINFO[0]-}" -lt 3 ]] || [[ "${BASH_VERSINFO[0]-}" -eq 3 && "${BASH_VERSINFO[1]}" -lt 2 ]]; then + echo "sorry, but the minimum version of BASH supported by bash_it is 3.2, consider upgrading?" >&2 + return 1 +fi + # Show how to use this installer function _bash-it-install-help() { echo -e "\n$0 : Install bash-it" diff --git a/plugins/available/history-eternal.plugin.bash b/plugins/available/history-eternal.plugin.bash index 26bea839e4..3b95cac606 100644 --- a/plugins/available/history-eternal.plugin.bash +++ b/plugins/available/history-eternal.plugin.bash @@ -3,7 +3,9 @@ about-plugin 'eternal bash history' if [[ ${BASH_VERSINFO[0]} -lt 4 ]] || [[ ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VERSINFO[1]} -lt 3 ]]; then _log_warning "Bash version 4.3 introduced the 'unlimited' history size capability." - return 1 + _log_warning "Disabling history-eternal plugin (current version: $BASH_VERSION)" + _disable-plugin history-eternal + return 0 fi # Modify history sizes before changing location to avoid unintentionally diff --git a/plugins/available/pack.plugin.bash b/plugins/available/pack.plugin.bash index 13b72c00e7..85d119186b 100644 --- a/plugins/available/pack.plugin.bash +++ b/plugins/available/pack.plugin.bash @@ -1,6 +1,13 @@ # shellcheck shell=bash # bash completion for pack -*- shell-script -*- +# Requires bash 4+ for associative arrays +# Skip loading if bash version is too old +if [[ "${BASH_VERSINFO[0]}" -lt 4 ]]; then + _disable-plugin pack + return 0 +fi + cite about-plugin about-plugin 'CNB pack cli aliases' diff --git a/plugins/available/percol.plugin.bash b/plugins/available/percol.plugin.bash index 027dfdc4af..b873aede6e 100644 --- a/plugins/available/percol.plugin.bash +++ b/plugins/available/percol.plugin.bash @@ -17,8 +17,9 @@ _command_exists percol || return if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then _log_warning "You have to upgrade Bash to Bash v4.x to use the 'percol' plugin." - _log_warning "Your current Bash version is $BASH_VERSION." - return + _log_warning "Disabling percol plugin (current version: $BASH_VERSION)" + _disable-plugin percol + return 0 fi function _replace_by_history() {