Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a check for the bash shell to archdetect #652

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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