On Sat, 4 Apr 2020 10:00:59 +0200, Stefan Seyfried
Am 04.04.20 um 08:38 schrieb Jan Engelhardt:
On Saturday 2020-04-04 00:06, Christian Boltz wrote:
/usr/bin/env bash has some disadvantages: - worst: the script might get a "random" bash (possibly /usr/local/bin/ bash) which is not expected by the packaged script, and might or might not work
That's actually not a "disadvantage". The *programmer* clearly requested a random bash - and, computers being what they are, deliver what was asked for. Garbage in, garbage out.
And it actually lets the admin take control by putting the bash he likes most further up $PATH, so I personally think it would be much better fixing rpm dependency scanners instead of forbidding usage of env.
But another, related question:
Why would anyone ever put /usr/bin/bash into a script shebang?
Because I have to (also) work on extremely old and sometime non-POSIX compliant boxes that do not even have bash installed. I sometimes need #!/bin/sh and sometimes #!/usr/bin/sh I put #!/usr/bin/bash on the she-bang to make the script unable to execute on systems that do not have bash, and "which bash" shows me /usr/bin/bash. That is why.
The /bin/bash symlink certainly is there to stay forever. So just using "#!/bin/bash" is not going to break anytime soon...
-- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.31 porting perl5 on HP-UX, AIX, and Linux https://useplaintext.email https://tux.nl http://www.test-smoke.org http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/