[CDBUG-talk] Sysadmin blog

Jaime jaime at snowmoon.com
Sun Nov 16 21:59:49 EST 2014


On Sun, Nov 16, 2014 at 9:39 PM, Brian Callahan <bcallah at devio.us> wrote:
> So this reminds me of an oft-forgotten point in portability of shell
> scripts: the popularity of the linuxism #!/bin/bash (though it appears it
> has crept into Mac OS X as well, sad...).

I was aware of the down sides of hard-coding the path to the script's
interpreter, but I wasn't aware of an alternative.  So thanks for
sharing the /usr/bin/env tip.  I have two thoughts that I hope you're
willing to hash-out with me, though.

1)  Isn't the shebang that you suggested still hardcoded?  When the
script is taken to a new OS, wouldn't there still be a risk of it
breaking?  Has env just been in Unix for so long that its always in
/usr/bin?

2)  On MacOS, bash is always installed at /usr/bin/bash.  My script
uses utilities specific to MacOS to modify configuration files
specific to MacOS in order to ease MacOS deployment.  It is inherently
irrelevent to other OSs and unable to move to another OS.  So is there
a benefit to changing the shebang to env?

Thanks!

Jaime


More information about the CDBUG-talk mailing list