uses both shell and python codes in one script.

Chris Angelico rosuav at gmail.com
Thu Oct 3 09:12:45 EDT 2019


On Thu, Oct 3, 2019 at 10:51 PM Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
>
> See this file:
>
> https://github.com/hongyi-zhao/dotbot/blob/master/bin/dotbot
>
> It uses both shell and python codes in one script, is this good practice?

Seems fine. Most of the code is elsewhere, and presumably has been
written to support both Py2 and Py3; the file you're linking to is
*just* a wrapper that finds an interpreter to use.

Though this should be unnecessary. A simple shebang of "/usr/bin/env
python3" will suffice for many many situations (and then if someone
specifically wants to run it in a legacy interpreter, an explicit
"python2 scriptname.py" or "python scriptname.py" will work).

ChrisA



More information about the Python-list mailing list