Hacker News new | ask | show | jobs
by etanol 5029 days ago
While I agree about the use of /usr/bin/env, you should be aware that some systems will perform only one word split on the shebang line. That means that if you use env, you can't pass any options to the $executable.

You can try it if you want, save this into an executable file (test.awk):

    #!/usr/bin/env awk -f
    { print $2 }
Then run:

    echo "Hello world again" | ./test.awk
I get the following:

    /usr/bin/env: awk -f: No such file or directory
1 comments

> I get the following:

Damn. I get "world" (OSX, zsh, BSD env)

So I supposed you can't pass options to `env` either (e.g. `-i`, or ENVVAR overrides?)

This is a kernel issue, it has nothing to do with userspace tools. For example, the Linux code responsible for parsing shebangs is here:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stabl...

Interesting, thanks for the info. I wouldn't have thought it so low in the architecture.