Lurker News

Comments (173) 27 threads

Show all comments

Showing thread 19 of 27

WhyNotHugo2 replies#
Using spaces in a shebang is not a standard thing and doesn’t work in most shells.
flakes1 reply#
Curious for what systems this does not work? I start a lot of my shebangs with `#!/usr/bin/env ` such that I can rely on PATH for resolving application locations.
chuckadams1 reply#
Just plain #!app also works. Probably less portable, but it does work on linux and macOS. Not sure if POSIX has anything to say about shebangs.
flakes1 reply#
Huh, I guess I've never given it too much thought. I was under the impression for some reason that the first argument was supposed to be an absolute path.
chuckadams#
It might have had to be absolute on ancient Unixen ... Unices? Seems POSIX has all of this to say about shebangs:

    If the first line of a file of shell commands starts with the characters "#!", the results are unspecified.
So it's basically all down to convention, but one that's been followed long enough that you can rely on it. I still don't count on shebang taking more than one argument to the command though.