Skip to content

Commit

Permalink
Add a check for the bash shell to archdetect
Browse files Browse the repository at this point in the history
  • Loading branch information
ocaisa committed Jul 29, 2024
1 parent 7dbb8df commit 05164ad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions init/eessi_archdetect.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
#!/usr/bin/env bash

# Confirm the current shell is Bash >= 4
check_bash() {
if [ -n "$BASH_VERSION" ]; then
# Extract the major version numbers
bash_version=$(echo "$BASH_VERSION" | grep -oP '^\d+\.\d+')
major_version=$(echo "$bash_version" | cut -d. -f1)

# Check if the major version is 4 or higher
if [ "$major_version" -ge 4 ]; then
return 0
else
echo "Error: This script must be run with Bash > 4, you have $BASH_VERSION." >&2
exit 1
fi
else
echo "Error: This script must be run with Bash." >&2
exit 1
fi
}
check_bash

VERSION="1.1.0"

# default log level: only emit warnings or errors
Expand Down

0 comments on commit 05164ad

Please sign in to comment.