Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 1
    Standards leave things unspecified to not tie down implementations to particular behaviours. For example, a "login" is "The unspecified activity by which a user gains access to the system." Commented Dec 18, 2018 at 7:41
  • 2
    Since POSIX doesn't specify executable paths, a shebang line is inherently non-portable anyway; I'm not sure much would be gained by specifying it regardless. Commented Dec 18, 2018 at 7:57
  • 1
    @MichaelHomer, surely not? The standard could specify that the line contains a path to use for the interpreter, even without telling what that path should be. Commented Dec 18, 2018 at 9:44
  • 1
    @HaroldFischer Except it's not interpreted by the shell, it's interpreted by either the OS kernel (done at least on Linux, which can actually disable this support during build time), or whatever library implements the exec() function. So checking against multiple shells doesn't really tell you how portable it is. Commented Dec 18, 2018 at 20:36
  • 3
    @HaroldFischer Furthermore, even among POSIX-compliant OSes the behavior isn't consistent. Linux and macOS behave differently: Linux does not fully tokenize the shebang line by spaces. macOS does not allow the script interpreter to be another script. Also see en.wikipedia.org/wiki/Shebang_(Unix)#Portability Commented Dec 18, 2018 at 21:30