I'm on Windows 7 64-bit and want to do something like below on the command line using Groovy:
echo "println('Hello, World...')" | groovy -e
But I can't seem to get the echo o/p to pass as i/p to the groovy command, and keep getting the below error:
error: illegal use of -e (requires a value)
Can someone please help?
Groovy doesn't have an option for reading the script from standard input. The -e
option is used to specify the script on the command line like this:
groovy -e "println('Hello World')"
If you really need to run a script piped into standard input, try this:
echo println('Hello World') | groovy -e 'new GroovyShell().evaluate(System.in)'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.