From 5a1521a46a244839f8c67e93377440e032c88f25 Mon Sep 17 00:00:00 2001 From: anonymous <> Date: Wed, 20 Dec 2023 10:32:41 -0500 Subject: [PATCH] create/update 'Blog - shebang.md' file --- Blog - shebang.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Blog - shebang.md diff --git a/Blog - shebang.md b/Blog - shebang.md new file mode 100644 index 0000000..8edd6fd --- /dev/null +++ b/Blog - shebang.md @@ -0,0 +1,29 @@ +# SHEBANG: The case for `/usr/bin/env bash` + +Not every system has binaries in the same location! + +From [Ycombinator](https://news.ycombinator.com/item?id=7596191) + + +>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 +* [Hey Kid, I'ma Interpreter!! Stop all the static interpreter referencin'!](https://deftly.net/posts/2014-03-17-stop-all-the-ref.html) +* [Howto Make Script More Portable With #!/usr/bin/env As a Shebang](http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html) +* [Rethinking Your shebang](http://www.brianstorti.com/rethinking-your-shebang/) \ No newline at end of file