Skip to content

Commit

Permalink
Check Bash version and fail gracefully if it's not set
Browse files Browse the repository at this point in the history
This closes aristocratos#55.
  • Loading branch information
Calinou committed Apr 28, 2020
1 parent 30aeef8 commit 08e8bbe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bashtop
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ declare -x LC_MESSAGES="C" LC_NUMERIC="C" LC_ALL=""
shopt -qu failglob nullglob
shopt -qs extglob globasciiranges globstar

#* Fail if Bash version is below 4.4
bash_version_major="$(echo $BASH_VERSION | cut -d "." -f 1)"
bash_version_minor="$(echo $BASH_VERSION | cut -d "." -f 2)"
if [[ "$bash_version_major" -lt 4 ]]; then
echo "ERROR: Bash 4.4 or later is required (you are using Bash $bash_version_major.$bash_version_minor)."
echo " Consider upgrading your distribution to get a more recent Bash version."
exit 1
else
if [[ "$bash_version_major" == 4 && "$bash_version_minor" -lt 4 ]]; then
echo "ERROR: Bash 4.4 or later is required (you are using Bash $bash_version_major.$bash_version_minor)."
echo " Consider upgrading your distribution to get a more recent Bash version."
exit 1
fi
fi

declare -a banner banner_colors

banner=(
Expand Down

0 comments on commit 08e8bbe

Please sign in to comment.