Does the author not like Firefox or what?
A surprise with how '#!' handles its program argument in practice
51–60 of 116 posts
Re: A surprise with how '#!' handles its program argument in practice
#52Earlier quoted context omitted.
Anything other than ”#!/usr/bin/env bash” is doomed to fail at some time.
> Anything other than ”#!/usr/bin/env bash” is doomed to fail at some time. if you have /usr/bin/env
Re: A surprise with how '#!' handles its program argument in practice
#53Huh. I wish I had known this before. NixOS is annoying because everything is weird and symlinked and so I find myself fairly frequently making the mistake of writing `#!/bin/bash`, only to be told it can't find it, and I have to replace the path with `/run/current-system/sw/bin/bash`. Or at least I thought I did; apparently I can just have done `#!bash`. I just tested this, and it worked fine. You learn something new…
> apparently I can just have done `#!bash` I think you're mixing two concepts: relative paths (which are allowed after #! but not very useful at all) and file lookup through $PATH (which is not done by the kernel, maybe it's some shell trickery).
It's libc. Specifically, system(3) and APIs like execvp(3) will search $PATH for the file specified before passing that to execve(2) (which is the only kernel syscall; all the other exec*() stuff is in libc).
Re: A surprise with how '#!' handles its program argument in practice
#54Re: A surprise with how '#!' handles its program argument in practice
#55Re: A surprise with how '#!' handles its program argument in practice
#56Earlier quoted context omitted.
Anything other than ”#!/usr/bin/env bash” is doomed to fail at some time.
> Anything other than ”#!/usr/bin/env bash” is doomed to fail at some time. if you have /usr/bin/env
Re: A surprise with how '#!' handles its program argument in practice
#57Re: A surprise with how '#!' handles its program argument in practice
#58You can have spacing after #! for some reason?
POSIX does not mandate -S, which means any script that uses it will only work on freebsd/linux
Re: A surprise with how '#!' handles its program argument in practice
#59Re: A surprise with how '#!' handles its program argument in practice
#60There's no security issue here. Certainly the OP hasn't explained why there is one.