Files
MarkdownNotes/blog - shebang - the case for env bash.md

1.1 KiB

SHEBANG: The case for /usr/bin/env bash

Not every system has binaries in the same location!

From Ycombinator

clarry 708 days ago

Are there any situations where you wouldnt be able to find bash in /bin/bash?

Yes there are.

OpenBSD for instance installs third party software under /usr/local. Bash is not a part of the base system.

env(1) on the other hand is a POSIX standard utility and comes with the OS.

kirubakaran 708 days ago

[in addition to what clarry said] Habit of using /usr/bin/env becomes more important in other use-cases, such as invoking Python interpreter.

nnnnni 708 days ago

Exactly. I often use #!/usr/bin/env python2 to specify python 2.x on my systems where python 3 is the default.

Reference