osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

uses both shell and python codes in one script.


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