4 ms·
Python's the only serious candidate that fits those requirements. Node is popular recently but I don't think e.g. Ubuntu installs it by default, or even has a
by cjbprime 7y ago
Python's the only serious candidate that fits those requirements. Node is popular recently but I don't think e.g. Ubuntu installs it by default, or even has a modern version in its apt repos.
- jasonhansel 7y agoIMHO Python makes it too hard to run shell commands & perform other Unix magic. Personally, I like perl5, perl6, and tcl in these respects, but those languages aren't especially popular now. EDIT: also virtualenvs make my head explode. I think node/npm is currently the best in terms of dependency management.
- kungtotte 7y agoImport a standard library module and write a single line of code is "too hard"?
- jasonhansel 7y agoYes. In perl 5 and shell, it's just magic backticks
- rsyring 7y agoSo...this is too hard? import subprocess subprocess.run(["ls", "-l"]) # or subprocess.run("exit 1", shell=True, check=True) Reference: https://docs.python.org/3/library/subprocess.html https://docs.python.org/3/library/subprocess.html
- blacksqr 7y agoTcl: exec ls -l
- tomthehero 7y agoIt's not hard, just too much noise. from subprocess import run run("ls -la".split()) This is what I do to reduce noise
- mindcrime 7y agoTry Groovy: $groovy -e ' println "ls -l /".execute().text' Without the "run the example on the command line" baggage, it reduces to: println "ls -l".execute().text assuming you just want to spit out the results. What's nice about this is that it's ultimately just syntactic sugar over the standard Java ProcessBuilder / Process mechanism, and it's relatively easy to support more advanced cases like defining your own input, output, and error streams for the underlying process, etc.