-
Notifications
You must be signed in to change notification settings - Fork 235
Use #!/usr/bin/env bash
instead of #!/bin/bash
#90
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
Conversation
macOS ships with an old version of bash that doesn't recognise `declare -A`. Using `/usr/bin/env bash` instead of referenceing `/bin/bash` directly allows macOS users to use homebrew supplied bash instead of the built-in one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if that doesn't exist?
|
Agreed that using Bash 4 features excludes macOS users from being able to build the images without some extra work. But then again Bash 4 is almost 10 years old now (released 20 Feb 2009) and it is possible for macOS users to install an up-to-date version. If you're building Docker on macOS then you probably have homebrew (or similar) installed already. There should just be some documentation around the requirement. |
Our policy for Adopt infra is to stick with Bash 3 because of the OS X reason. I think we'd at least want a documentation update if the docker images are going to support Bash 4 |
As a side note, I’m updating slim-java.sh to be compatible with bash or dash (thank heavens for ShellCheck), which should eliminate the need to |
@dinogun Not sure whether we should merge this or not - thoughts? |
I would say it is more elegant way of running script - not to focus on specific binary. From the other side - why not just require to install bash4 on mac ? It does not seems like big issue (https://itnext.io/upgrading-bash-on-macos-7138bd1066ba) |
Mac OS X 10.10 doesn't support modern HomeBrew and I think it's difficult to therefore install bash4+ |
From the homebrew docs
Also Docker for Mac requires 10.12 anyway. |
Maybe I'm misunderstanding you but that howto guide also installs bash4+ via homebrew which I what I did. Important to note that this won't replace the OS bundled one at |
In that case we're probably OK to do this. |
macOS ships with an old version of bash that doesn't recognise
declare -A
. Using/usr/bin/env bash
instead of referencing/bin/bash
directly allows macOS users to use homebrew supplied bash instead of the built-in one.