diff options
author | Einhard Leichtfuß <alguien@respiranto.de> | 2024-12-23 12:38:10 +0100 |
---|---|---|
committer | Einhard Leichtfuß <alguien@respiranto.de> | 2024-12-23 12:38:10 +0100 |
commit | d8fa62a5f951a82b78958b936be31913f1c56430 (patch) | |
tree | efba0e4a8805956874514d7e631cfa919a7e8d66 | |
parent | 11859d9c9d1f9cd78c6878a7c4421ed29c797889 (diff) |
Check for minimum Bash version (5.2)
We need 5.2 for the `globskipdots` shell option. 5.2 happens to be the
current version in Debian 12 (bookworm).
-rw-r--r-- | src/basic.bash | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/basic.bash b/src/basic.bash index a9d0a10..5af4cd6 100644 --- a/src/basic.bash +++ b/src/basic.bash @@ -3,6 +3,24 @@ # Copyright 2020-2024 Einhard Leichtfuß +######################### +## Minimum Bash version + +if [ -z "$BASH_VERSINFO" ] +then + printf 'Failed: $BASH_VERSINFO undefined or null.\n' >&2 + exit 1 +fi +if [[ ${BASH_VERSINFO[0]:-0} -lt 5 + || ( ${BASH_VERSINFO[0]:-0} -eq 5 && ${BASH_VERSINFO[1]:-0} -lt 2 ) + ]] +then + printf 'Failed: Bash version < 5.2.\n' >&2 + exit 1 +fi + + + ################################### ## Error and termination handling |