mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
oh-my-bash: Check Bash version on startup
This commit is contained in:
@ -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 \"\$@\"; }"
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user