Update generate_config.sh version checking for wider compatibility #6270
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: replace
grep -oP
withgrep -oE
for broader compatibilityThe
-P
option (Perl-compatible regex) is not supported in all versions ofgrep
, particularly the default BSDgrep
on macOS. This change replaces-P
with-E
(extended regex), which is more widely available and ensures compatibility across different environments.Tested on macOS and Linux.
Contribution Guidelines
What does this PR include?
Short Description
This PR replaces
grep -oP
withgrep -oE
to improve compatibility across different environments. The-P
option (Perl-compatible regex) is not supported in all versions ofgrep
, particularly the default BSDgrep
on macOS. The script fails in its current format on MacOS. Using-E
(extended regex) ensures broader support while maintaining the intended functionality.Affected Containers
None (this is a script change, not a change to Docker containers).
Did you run tests?
What did you test?
Tested the updated command on both macOS and Linux to ensure it extracts the major version correctly.
What were the final results? (Expected, actual)
Expected: The command should return only the major version number from
docker --version
.Actual: The command correctly returns the major version number on both macOS and Linux.