kobo / groovyserv

Groovy's startup acceralator.
http://kobo.github.io/groovyserv/
Other
98 stars 10 forks source link

Scanner reading from console #57

Closed rmchale closed 8 years ago

rmchale commented 10 years ago

What's the proper way to do a script like this?

#!/usr/bin/env groovyclient

Scanner scan = new Scanner(System.in);

print "Type please: "

def line = scan.nextLine()

println "You typed $line"
nobeans commented 10 years ago

Sorry, I've noticed this issue just now.

Your sample code works well for me:

$ groovy sample.groovy
Type please: hello
You typed hello
$ groovyclient sample.groovy
Type please: hello
You typed hello
$ ./sample.groovy
Type please: hel

Do you want just an alternative way? Or, did you get an unexpected result?