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.
mindcrime|6 years ago