mathiasbynens / dotfiles

:wrench: .files, including ~/.macos — sensible hacker defaults for macOS
https://mths.be/dotfiles
MIT License
30.16k stars 8.74k forks source link

Update bash shebang for better portability #196

Closed AJ-Acevedo closed 11 years ago

AJ-Acevedo commented 11 years ago

It's recommended to update the bash shebang in .osx for better portability.

FROM

#!/bin/bash

TO

#!/usr/bin/env bash
mathiasbynens commented 11 years ago

In what version of OS X would #/bin/bash not work, i.e. in what OS X versions is /bin/bash not available by default? I don’t know of any.

AJ-Acevedo commented 11 years ago

If you update bash via homebrew, it will install it in /usr/local/bin/bash. Other package managers like Fink, and MacPorts may do something similar.

mathiasbynens commented 11 years ago

It doesn’t really matter which Bash version is used to run bootstrap.sh or .osx since they don’t use any modern Bash features AFAIK, but you make a fair point: “If the user installs a custom Bash build, why not use it?”

According to @janmoesen, shebangs like #!/usr/bin/env bash used to fail in very old shells since it would go looking for a file called /usr/bin/env bash and fail, but that was A Very Long Time Ago™.

@AJ-Acevedo Mind submitting a pull request that changes all shebangs to #!/usr/bin/env bash?

delip commented 11 years ago

you're right. I still have to see an instance where env bash fails.

On Fri, Apr 26, 2013 at 8:42 AM, Mathias Bynens notifications@github.comwrote:

It doesn’t really matter which Bash version is used to run bootstrap.shor .osx since they don’t use any modern Bash features AFAIK, but you make a fair point: “If the user installs a custom Bash build, why not use it?”

According to @janmoesen https://github.com/janmoesen, shebangs like #!/usr/bin/env bash used to fail in very old shells since it would go looking for a file called /usr/bin/env bash and fail, but that was A Very Long Time Ago™.

@AJ-Acevedo https://github.com/AJ-Acevedo Mind submitting a pull request that changes all shebangs to #!/usr/bin/env bash?

— Reply to this email directly or view it on GitHubhttps://github.com/mathiasbynens/dotfiles/issues/196#issuecomment-17082208 .

AJ-Acevedo commented 11 years ago

I'll submit one tonight.