summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic.bash18
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