uses both shell and python codes in one script.

Cameron Simpson cs at cskk.id.au
Thu Oct 3 19:13:05 EDT 2019


On 04Oct2019 03:34, Chris Angelico <rosuav at gmail.com> wrote:
>On Fri, Oct 4, 2019 at 12:15 AM James Lu <jamtlu at gmail.com> wrote:
>> I would use IPython as a scripting language. It has a slow startup 
>> time though.
>>
>And how, in the messy world of cross-platform scripting, would you
>locate the interpreter? The whole point of this script is to attempt
>three different shebangs, effectively.

Well, yes, but personally I'd prefer to just run with "#!/usr/bin/env 
python3". Then the command line will say "python3: not found" or 
similar, I can fix my environment, and thereafter everything works 
better. Rather than complex magic inside a script.

If we're going to accept the approach though, I'd rather the shebang was 
just "#!/bin/sh". There's _always_ a /bin/sh, and a number of BSDish 
systems do not have a /usr/bin/env (it tends to land in /bin instead).

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list