Skip to content

Commit

Permalink
Merge pull request #652 from ocaisa/archdetect_bash4
Browse files Browse the repository at this point in the history
Add a check for the bash shell to `archdetect`
  • Loading branch information
trz42 authored Aug 8, 2024
2 parents a54c0d8 + bbe101b commit 3db7ade
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions init/eessi_archdetect.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/usr/bin/env bash

# Confirm the current shell is Bash >= 4
# (works for sh, bash, dash, zsh, ksh, but not fish, tcsh, elvish)
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" -lt 4 ]; then
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

VERSION="1.1.0"

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

0 comments on commit 3db7ade

Please sign in to comment.