Use #!/usr/bin/env bash
in get-info.sh
to support macOS users
#35
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.
get-info.sh
uses themapfile
commandpangeo-forge-gcs-bakery/scripts/get-info.sh
Line 23 in 5ee5287
This does not work out-of-the-box on macOS, because even the latest Macs (mine is about ~2 months old) ship with system bash as bash 3, but
mapfile
was introduced in bash 4. 👈 This linked issue recommends upgrading bash with homebrew and thensudo mv /usr/local/bin/bash /bin/bash
. This solution might work in a GitHub Workflows context, but on an actual MacBook, write access to/bin
is blocked (even for root users) by security features which are cumbersome to circumvent.For executing scripts with user-installed versions of bash, this tutorial recommends the
#!/usr/bin/env bash
syntax added in this PR. I contemplated replacing#!/bin/bash
with this in all of the scripts for consistency, but thought it would be better to only make the minimal required change.I am going to add a check for bash version to this PR, so the code self-documents why we are doing this, and then I will open for review.
xref #19 (b/c this issue arose as part of that work)