I've always heard that the target of a shebang line (e.g.
#!/bin/bash
) must be a binary executable, not a script. And this is still true for many OSes (e.g. MacOS). But I was surprised to see that this is not true on Linux, where up to 4 levels of scripts can be used, where the fourth script references a binary executable in its shebang line. However, if 5 levels of scripts are used, then the program will fail with the error Too many levels of symbolic links
.
See the LWN article "How programs get run" and the following code which was not shown in that article.
$ cat wrapper2
#!./wrapper
When did this change occur (assuming that at some point it was not allowed)?
Asked by jrw32982
(1089 rep)
Apr 26, 2024, 04:23 PM
Last activity: Apr 26, 2024, 05:02 PM
Last activity: Apr 26, 2024, 05:02 PM