You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The declare command has been available since very early versions of Bash (pre-4.0), so if you have Bash 4.2 or higher, you definitely have access to the declare builtin.
I copied audit.sh and check_indexes.sh into my project and made audit.sh executable:
./check_indexes.sh: line 247: conditional binary operator expected
If I comment out the line causing this error, I get:
Analyzing schema.rb for missing indexes...
Error: This script requires Bash version 4.2 or later for declare -g support.
Your current Bash version is: 3.2.57(1)-release
Please upgrade your Bash version to run this script.
So, it’s likely not a bug but syntax that only works on Bash 4.2+.
If that’s the case, it might be worth updating the README.md or adding a version check in the script itself like:
# Check Bash version 4.2 or high to have support for 'declare'
minimum_required_version="4.2"if [ -z"$BASH_VERSION" ] || [[ "${BASH_VERSION%%[^0-9.]*}"<"$minimum_required_version" ]];thenecho"Error: This script requires Bash version $minimum_required_version or higher."exit 1
fi
After i did a basic brew install bash i got the 5.2 and now it works fine
Have a great day
The text was updated successfully, but these errors were encountered:
I copied audit.sh and
check_indexes.sh
into my project and madeaudit.sh
executable:When I run it, I get:
If I comment out the line causing this error, I get:
So, it’s likely not a bug but syntax that only works on Bash 4.2+.
If that’s the case, it might be worth updating the README.md or adding a version check in the script itself like:
After i did a basic
brew install bash
i got the 5.2 and now it works fineHave a great day
The text was updated successfully, but these errors were encountered: