Re: shebanged script not executed right - wth

From: Richard M Kreuter <kreuter_at_progn.net>
Date: Sat, 09 Aug 2025 12:17:45 UTC
fatty.merchandise677@aceecat.org writes:

> $ cat /opt/compat/python3
> #! /bin/sh
>
> exec /usr/local/bin/python3 "$@"
> $
<snip>
> $ head /opt/compat/relaymail
> #! /opt/compat/python3

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.

Could you have /opt/compat/python3 be a symlink to
/usr/local/bin/python3?

> IS THIS A KERNEL BUG ???

Unices have never agreed exactly on #!-line behavior. Here's one
person's attempt to document differences:

https://www.in-ulm.de/~mascheck/various/shebang/

The relevant section for this thread is

https://www.in-ulm.de/~mascheck/various/shebang/#interpreter-script

Regards,
Richard