Re: uses both shell and python codes in one script.

2019-10-28 Thread Peter J. Holzer
On 2019-10-04 09:15:41 +1000, Chris Angelico wrote: > On Fri, Oct 4, 2019 at 9:08 AM Cameron Simpson wrote: > > On 03Oct2019 23:55, Chris Angelico wrote: > > >In the shell, the first two are an empty string, then ':' is a > > >colon, which introduces a label (the fact that it's in quotes is > > >

Re: uses both shell and python codes in one script.

2019-10-03 Thread Cameron Simpson
On 04Oct2019 09:17, Chris Angelico wrote: On Fri, Oct 4, 2019 at 9:13 AM Cameron Simpson wrote: 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

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Fri, Oct 4, 2019 at 9:13 AM Cameron Simpson wrote: > > On 04Oct2019 03:34, Chris Angelico wrote: > >On Fri, Oct 4, 2019 at 12:15 AM James Lu 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 s

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Fri, Oct 4, 2019 at 9:08 AM Cameron Simpson wrote: > > On 03Oct2019 23:55, Chris Angelico wrote: > >On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: > >> I'm very confusing on the following part in this script: > >> > >> > >> ''':' # begin python string; this line is interpreted by the

Re: uses both shell and python codes in one script.

2019-10-03 Thread Cameron Simpson
On 04Oct2019 03:34, Chris Angelico wrote: On Fri, Oct 4, 2019 at 12:15 AM James Lu 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

Re: uses both shell and python codes in one script.

2019-10-03 Thread Cameron Simpson
On 03Oct2019 23:55, Chris Angelico wrote: On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: I'm very confusing on the following part in this script: ''':' # begin python string; this line is interpreted by the shell as `:` which python >/dev/null 2>&1 && exec python "$0" "$@" which py

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Fri, Oct 4, 2019 at 12:15 AM James Lu 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,

Re: uses both shell and python codes in one script.

2019-10-03 Thread Michael Torrie
On 10/3/19 8:15 AM, James Lu wrote: > I would use IPython as a scripting language. It has a slow startup time > though. Lately I've been using Xonsh, which is a much more comfortable application of Python to shell scripting than anything else I've tried. Occasionally subprocess mode selection vs P

Re: uses both shell and python codes in one script.

2019-10-03 Thread James Lu
I would use IPython as a scripting language. It has a slow startup time though. On Thu, Oct 3, 2019 at 9:59 AM Chris Angelico wrote: > On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: > > > > On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > > > > > > > Seems fine. Most of the code

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Thu, Oct 3, 2019 at 11:41 PM Hongyi Zhao wrote: > > On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > > > > 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 inte

Re: uses both shell and python codes in one script.

2019-10-03 Thread Hongyi Zhao
On Thu, 03 Oct 2019 23:12:45 +1000, Chris Angelico wrote: > 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

Re: uses both shell and python codes in one script.

2019-10-03 Thread Chris Angelico
On Thu, Oct 3, 2019 at 10:51 PM Hongyi Zhao 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 h

uses both shell and python codes in one script.

2019-10-03 Thread Hongyi Zhao
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? -- https://mail.python.org/mailman/listinfo/python-list