Closed dark-panda closed 10 years ago
I'm not aware of any systems that don't have at least a bash in /bin/bash
. Google's bash style guide recommends this shebang as well. Users might have additional bash versions installed in e.g. /usr/local
, but the rbenv-each script can work with any version of bash.
Does this shebang actually create a problem for you? If not, I would close this as a non-issue
Let me take a look at the recent FreeBSD system I built. On that system, /bin/sh was there, but bash had to be installed via ports, which put bash into /usr/local/bin/bash. I'll take look when I'm back at my laptop.
According to the docs, bash isn't in the default FreeBSD install.
http://www.freebsd.org/doc/en/articles/linux-users/shells.html
It might be worth it to just rely on sh instead of bash, perhaps, unless there are bash-specific features required?
Just checked my FreeBSD VM and did a bit of reading. On FreeBSD, OpenBSD, and likely other BSDs and various other UNIX-y systems bash isn't available by default. On BSDs, bash is often installed after the fact, and in many cases ends up in /usr/local/bin
. The aforementioned Google style guide is likely written with a linux-based system in mind, and bash is usually installed by default and is usually located in /bin
. Since /bin
isn't a guaranteed location for bash, it would be safer and more portable to use /usr/bin/env
, which is much more likely to exist, albeit even the location of env
itself is not guaranteed by POSIX or any sort of standard that I am aware of. rbenv's own scripts use #!/usr/bin/env bash
, so you might as well go with that, since if rbenv isn't working, then what's the point?
OK, thanks
The rbenv-each script hardcodes the location of bash to /bin/bash in the shebang line. Using
#!/usr/bin/env bash
would remove that hardcoding and allow it to be found anywhere within a user's $PATH, i.e. when bash is installed in /usr/local/bin or /opt/local/bin or whatever.