How to manage python shebang on mixed systems?

Thomas Passin list1 at tompassin.net
Mon Nov 7 18:09:33 EST 2022


More discussion:

https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my

On 11/7/2022 5:35 PM, Cameron Simpson wrote:
> On 07Nov2022 09:28, Chris Green <cl at isbd.net> wrote:
>> Chris Green <cl at isbd.net> wrote:
>>> > 3: with your pseudo "python3" script in place, make all the scripts 
>>> use
>>> > the "#!/usr/bin/env python3" shebang suggested above.
>>> >
>>> Yes, that sounds a good plan to me, thanks Cameron.
>>>
>> Doesn't '#!/usr/bin/env python3' suffer from the same problem as
>> '#!/usr/bin/python3' in the sense that the env executable might not be
>> in /usr/bin?
>>
>> Wouldn't '#! env python3' be better?
> 
> The thing after the shebang needs to be a full path.
> 
> "env" is in /usr/bin on damn near everything. I think I had to make a 
> symlink on a Solaris system once, but otherwise it has not been a 
> problem for me on many different systems for many years.
> 
> Cheers,
> Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list