Skip to content
Permalink
Browse files

Changed shebang to /bin/bash instead of using env

  • Loading branch information...
LuRsT committed Apr 2, 2016
1 parent dffb60e commit 61b938bb4f622c42eba3f3aa31e233be870408c1
Showing with 1 addition and 1 deletion.
  1. +1 −1 hr
2 hr
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash

# The MIT License (MIT)
#

6 comments on commit 61b938b

@jomo

This comment has been minimized.

Copy link

replied Apr 2, 2016

What's the reason for this? IMO using env is superior:

$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.

vs.

/usr/bin/env bash --version
GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin15.0.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@LuRsT

This comment has been minimized.

Copy link
Owner Author

replied Apr 2, 2016

I'm glad someone is paying attention :). I made that change after a short investigation pf which would be best and it seems that using /bin/bash is the safest choice.

This is one of the resources I found about this:
https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my/29620#29620

Ultimately, I think that on our modern systems, this is really not important, but I'd like to know from the author of that StackOverflow url (which coincidentally is contributor to this project, small world) his opinion.

@Keith-S-Thompson, could you help us find out which is the best for this project?

@Keith-S-Thompson

This comment has been minimized.

Copy link
Contributor

replied Apr 3, 2016

IMHO #!/bin/bash is better, at least partly because it's simpler.

You can reasonably rely on bash being installed as /bin/bash on any modern system (assuming it has bash at all). Using #!/usr/bin/env bash picks up whatever bash happens to be in the user's $PATH. That might be a newer version, but for this particular script that shouldn't make any difference. And if the version of bash matters, #!/usr/bin/env bash isn't likely to help.

There's also no guarantee that env is installed as /usr/bin/env (I've used old systems where it isn't).

Having said that, either one should work, and it probably doesn't make any real difference. In any case, the user can easily edit the script.

@LuRsT

This comment has been minimized.

Copy link
Owner Author

replied Apr 3, 2016

Thanks @Keith-S-Thompson for your input, that is also my opinion, the only thing that I'm not sure about is in FreeBSD, bash's location is not in /bin/(http://www.cyberciti.biz/faq/freebsd-bash-installation/), but I'm not sure if even env would solve it...

@Keith-S-Thompson

This comment has been minimized.

Copy link
Contributor

replied Apr 3, 2016

FreeBSD users can easily create a symlink (/bin/bash -> /usr/local/bin/bash) or just edit the #!.

There are gajillions of scripts out there with #!/usr/bin/bash shebangs. FreeBSD users presumably have found ways to deal with them.

@LuRsT

This comment has been minimized.

Copy link
Owner Author

replied Apr 4, 2016

True that, thanks again for your input!

Please sign in to comment.
You can’t perform that action at this time.