Re: shebanged script not executed right - wth

From: Souji Thenria <mail_at_souji-thenria.net>
Date: Sat, 09 Aug 2025 08:03:58 UTC
On Sat Aug 9, 2025 at 7:39 AM CEST,  wrote:
> I have the following setup, which works as intended on multiple quite
> different penguin systems:
>
> $ ls -la /opt/compat
> total 16
> drwxr-xr-x  2 root wheel  512 Aug  8 19:46 .
> drwxr-xr-x  4 root wheel  512 Aug  3 13:17 ..
> lrwxr-xr-x  1 root wheel   19 Aug  3 15:16 bash -> /usr/local/bin/bash
> lrwxr-xr-x  1 root wheel   19 Aug  3 13:18 perl -> /usr/local/bin/perl
> -rwxr-xr-x  1 root wheel   45 Aug  3 13:18 python3
> -rwxr-xr-x  1 root wheel 1462 Aug  8 19:46 relaymail
> $ cat /opt/compat/python3
> #! /bin/sh
>
> exec /usr/local/bin/python3 "$@"
> $
>
> On the penguin systems, of course it's /usr in place of /usr/local.
>
> The idea is that scripts can put these locations for the interpreters
> into their shebangs, so I can use literally the same script on
> penguins and daemons.
>

You can use '#!/usr/bin/env python3' as shebang in your scripts. This
would work on Linux as well as FreeBSD, OpenBSD and so on.

Regards,
Souji

-- 
Souji Thenria
Website: www.souji-thenria.net