Re: shebanged script not executed right - wth
Date: Sat, 09 Aug 2025 12:42:14 UTC
Richard M Kreuter <kreuter@progn.net> writes: > I believe that on FreeBSD (and probably most Unices, historically), the > pathname after "#!" must resolve to an executable binary, i.e., an > interpreted program cannot serve as an #!-line interpreter. Correct. As Souji points out, you can work around this limitation by using `#!/usr/bin/env python3`, which has the advantage of working regardless of where python3 is installed, as long as it's in your PATH. Linux supports nested shebangs, and it wouldn't be hard to implement, but it raises the question of what to do in case of a loop. Without loop detection, we will eventually hit ARG_MAX (because argv grows with each additional shebang level), but ARG_MAX is pretty big these days, so it may take a while to fail. DES -- Dag-Erling Smørgrav - des@FreeBSD.org