top | item 20373787

(no title)

tomthehero | 6 years ago

It's not hard, just too much noise.

from subprocess import run run("ls -la".split())

This is what I do to reduce noise

discuss

order

mindcrime|6 years ago

Try 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.