News for hackers. Stuff that matters.
Re:Upstream vendors and why they can be harmful by olgeni on Monday November 12, 2012 @06:17AM (#4772375)
Starting from small things, it would also be great to stop using #!/bin/bash in scripts for no apparent reason (hint: "it's my default shell" is not a good reason.)
Re:Upstream vendors and why they can be harmful by pja on Monday November 12, 2012 @08:26AM (#4772720)
I'd far rather people did that than used #!/bin/sh and assumed that sh was bash!
Re:Upstream vendors and why they can be harmful by papsosouid on Monday November 12, 2012 @11:18AM (#4773394)
It isn't a choice between "do it wrong A" and "do it wrong B". There are a whole host of options, one of which is "do it right". Relying on a non-standard shell to be in /bin is bad, relying on non-standard shell extensions to be in the standard shell is also bad. So either use the standard shell as the standard shell, or use whatever nonstandard shell you want by calling env to find it.
Re:Upstream vendors and why they can be harmful by klibertp on Monday November 12, 2012 @12:43PM (#4773798)
I am not well versed in shell magic, but this one bit me quite a few times because, being on FreeBSD, my bash lives under /usr/local/bin (and I installed it just for the scripts written by other people, too).

I'd like to ask you what can I do with this, ie. how can I modify those scripts so that they work both on my machine and on others'? I don't want (obviously) to symlink bash executable to /bin. I guess that using plain sh, which actually is in /bin wouldn't be good either, because (I suppose) if author wanted bash it was on purpose. How to write shebangs so that they are compatible with Linux and BSD at the same time?

Re:Upstream vendors and why they can be harmful by jsnell on Monday November 12, 2012 @12:57PM (#4773855)
The standard hack for that would be:

#!/usr/bin/env bash