Skip to main content
Statement informing the incorrection of the example given, and informing the actual situation
Source Link
flavio
  • 173
  • 6

EDIT: The question and the answers are correct, but the problem I stated here is not. The maintainer actually REFUSED to use /usr/bin/env as a solution and instead recreated the script as an sh one, and doing that broke other users installs. So, using env for finding bash is not POSIX, but is default "enough" to be considered a standard.

I'm having some errors on installing software on nixos (specifically the haskell stack ) and after some digging on internet, I found some examples of people having trouble with the specific path of installed software. Here an example where a maintainer reverted a modification to a /usr/bin/env solution on finding bash because it broke other users installations.

So, referring to env on a shebang without informing the absolute path of installation (relying on the system search path) is something that could be considered wrong?

I mean is ok using

#!env bash

instead of

#!/usr/bin/env bash

if the absolute path of installation for env itself is not default on all systems?

I'm having some errors on installing software on nixos (specifically the haskell stack ) and after some digging on internet, I found some examples of people having trouble with the specific path of installed software. Here an example where a maintainer reverted a modification to a /usr/bin/env solution on finding bash because it broke other users installations.

So, referring to env on a shebang without informing the absolute path of installation (relying on the system search path) is something that could be considered wrong?

I mean is ok using

#!env bash

instead of

#!/usr/bin/env bash

if the absolute path of installation for env itself is not default on all systems?

EDIT: The question and the answers are correct, but the problem I stated here is not. The maintainer actually REFUSED to use /usr/bin/env as a solution and instead recreated the script as an sh one, and doing that broke other users installs. So, using env for finding bash is not POSIX, but is default "enough" to be considered a standard.

I'm having some errors on installing software on nixos (specifically the haskell stack ) and after some digging on internet, I found some examples of people having trouble with the specific path of installed software. Here an example where a maintainer reverted a modification to a /usr/bin/env solution on finding bash because it broke other users installations.

So, referring to env on a shebang without informing the absolute path of installation (relying on the system search path) is something that could be considered wrong?

I mean is ok using

#!env bash

instead of

#!/usr/bin/env bash

if the absolute path of installation for env itself is not default on all systems?

Post Migrated Here from serverfault.com (revisions)
Source Link
flavio
  • 173
  • 6

shebangs with absolute paths are default (POSIX)?

I'm having some errors on installing software on nixos (specifically the haskell stack ) and after some digging on internet, I found some examples of people having trouble with the specific path of installed software. Here an example where a maintainer reverted a modification to a /usr/bin/env solution on finding bash because it broke other users installations.

So, referring to env on a shebang without informing the absolute path of installation (relying on the system search path) is something that could be considered wrong?

I mean is ok using

#!env bash

instead of

#!/usr/bin/env bash

if the absolute path of installation for env itself is not default on all systems?