Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by jeroenhd on Sunday November 22, 2020 @07:36PM
(#25182431)
It doesn't? If I write this into a file (/tmp/test.py):
#!/usr/bin/env python
print("Hello, world!")
and mark it as executable (chmod +x /tmp/test.py), I can just execute it as /tmp/test.py like I would do with any bash file.If you mean invocation as "execute a command that I'm passing", 'python -c' does exactly that.
Even as a complete shell it works including changing directories and using standard python to do file IO, though it won't execute any system executables and doesn't do piping like you'd like from a shell. It's not intended for that purpose so I can't really blame python for that.
Re:Show HN: Making Python one-liner-fit with the new pwk (Py...
by black_puppydog on Sunday November 22, 2020 @08:44PM
(#25182819)
> though it won't execute any system executables and doesn't do piping like you'd like from a shell
I think that's what xonsh was made for? :)
I've ended up using Groovy for this level of scripting, and it works really well.