Showing posts with label groovy. Show all posts
Showing posts with label groovy. Show all posts

Wednesday, August 21, 2013

groovy one liners on windows

Having seen perl one liners in the past, I was immediately drawn to groovy one liners.  Two posts from Dustin you would immediately get through google one & two.  So while playing with I ran into issue with quotes, rather escaping them.  Below one liner will wait forever:

groovy -e 'println "hostname".execute().text'

You should always use double quote to contain the one liner as below:

groovy -e "println 'hostname'.execute().text"
groovy -e "println java.nio.ByteOrder.nativeOrder()"