4 ms·
You shouldn't be using /bin/bash anyway. The proper she-bang is '#!/usr/bin/env bash', which works on nix. The location of bash in /bin/ is actually not standar
by tathougies 9y ago
You shouldn't be using /bin/bash anyway. The proper she-bang is '#!/usr/bin/env bash', which works on nix. The location of bash in /bin/ is actually not standard at all, despite some linux distributions doing that. In particular, the BSDs also do not have bash in /bin. This is why using '/usr/bin/env bash' is more portable
- wereHamster 9y agoBut is `/usr/bin/env` standard?
- satbyy 9y agoConversely, Python's PEP394 explicitly discourages `/usr/bin/env python`, so there's that. (I know why the PEP says so, just pointing out that it differs from Nix style)
- adamtulinius 9y agoThe PEP doesn't even mention /usr/bin/env. Look for yourself: https://www.python.org/dev/peps/pep-0394/ https://www.python.org/dev/peps/pep-0394/
- muxator 9y agoI've always mechanically written '#!/bin/bash' as my shebang for bash script, while I normally use '#!/usr/bin/env python' for python scripts. In retrospect, that sounds obviously incoherent. I would like to know if there is some common practice/standard around using '/usr/bin/env' in shebangs. Could you please elaborate more?
- eikenberry 9y ago> /usr/bin/env That won't work everywhere either as the location of 'env' is not a fixed standard either. Eg. In some *nix's its at /bin/env.
- pxc 9y agoWhat modern/surviving Unix-likes don't have even a symlink in `/usr/bin/env`? I'm not 100% sure on all of these, but every one of the dozens of Linux distros I've used has `/usr/bin/env`. macOS has it, and it looks like FreeBSD does, too, and so does NetBSD. Who are the oddballs? Does it include any of the free Unices?
- pxc 9y ago(I'm not trying to be shitty; I'd really like to know. I spent some time Googling about conventions for the `env` command, and examples of incompatible systems. The only ones I found were two old, proprietary Unices. I got tired of searching and was hoping someone who knows a few examples offhand could help me out.)
- eridius 9y agoIncidentally, macOS, whose CLI is derived from BSD, does in fact have /bin/bash.