Running Groovy script from the command line

You need to run the script like this:

groovy helloworld.groovy

#!groovy
println("hello world!")
$ chmod +x script.groovy
$ ./script.groovy