Skip to content

Commit

Permalink
Changed shebang to /bin/bash instead of using env
Browse files Browse the repository at this point in the history
  • Loading branch information
LuRsT committed Apr 2, 2016
1 parent dffb60e commit 61b938b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hr
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash

# The MIT License (MIT)
#
Expand Down

6 comments on commit 61b938b

@jomo
Copy link

@jomo jomo commented on 61b938b Apr 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

@LuRsT LuRsT commented on 61b938b Apr 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

@LuRsT LuRsT commented on 61b938b Apr 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

@LuRsT LuRsT commented on 61b938b Apr 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that, thanks again for your input!

Please sign in to comment.