News for hackers. Stuff that matters.
Re:Bash 5.2 by chungy on Tuesday September 27, 2022 @02:44PM (#32999364)
> Why not make all your shell scripts #!/bin/bash

Because it's not always installed there. See, for example, FreeBSD where bash typically lives in /usr/local/bin/bash. Or in the Linux world, Nix and Guix.

Use "#!/usr/bin/env bash" to account for all these possibilities.

Re:Bash 5.2 by Ferret7446 on Saturday October 01, 2022 @01:38AM (#33044196)
If we're going to be pedantic, env doesn't have to be installed at /usr/bin/env either. See https://www.felesatra.moe/blog/2021/07/03/portable-bash-sheb...
Re:Bash 5.2 by tpoacher on Tuesday September 27, 2022 @05:06PM (#33001121)
i cant remember where I saw it now, or what the main argument was, but I remember reading a rather authoritative article recommending against the env approach, and recommending people stick to #!/bin/bash regardless of the above, otherwise valid point.

Dunno if anyone here with a better memory remembers the article to link here ...

Re:Bash 5.2 by asicsp on Wednesday September 28, 2022 @12:06AM (#33004138)