diff --git a/lib/utils.sh b/lib/utils.sh index 30764e96b..fdc6b41dd 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -73,7 +73,6 @@ ################################################################################ _omb_version=10000 -_omb_bash_version=$((BASH_VERSINFO[0] * 10000 + BASH_VERSINFO[1] * 100 + BASH_VERSINFO[2])) function _omb_util_setexit { return "$1" @@ -93,7 +92,7 @@ function __omb_util_defun_deprecate__message { function _omb_util_defun_deprecate { local warning= - ((_omb_version>=$1)) && + ((_omb_version >= $1)) && warning='__omb_util_defun_deprecate__message "$2" "$3"; ' builtin eval -- "function $2 { $warning$3 \"\$@\"; }" } diff --git a/oh-my-bash.sh b/oh-my-bash.sh index 49c5c91e1..4cffb3351 100644 --- a/oh-my-bash.sh +++ b/oh-my-bash.sh @@ -10,6 +10,17 @@ case $- in *) return;; esac +if [ ! -n "${BASH_VERSION-}" ]; then + printf '%s\n' 'oh-my-bash: This is not a Bash. Use OMB with Bash 3.2 or higher.' >&2 + return 1 +fi +_omb_bash_version=$((BASH_VERSINFO[0] * 10000 + BASH_VERSINFO[1] * 100 + BASH_VERSINFO[2])) +if ((_omb_bash_version < 30200)); then + printf '%s\n' "oh-my-bash: OMB does not support this version of Bash ($BASH_VERSION)" >&2 + printf '%s\n' "oh-my-bash: Use OMB with Bash 3.2 or higher" >&2 + return 1 +fi + # Check for updates on initial load... if [[ $DISABLE_AUTO_UPDATE != true ]]; then source "$OSH"/tools/check_for_upgrade.sh