Using groovysh to try out Groovy commands

Similar to many other languages (for example, Ruby or Perl), Groovy sports a so called Read - Evaluate - Print loop (REPL). REPL is a simple, interactive programming environment mostly used to quickly try out language features. Groovy's REPL is named groovysh, and in this recipe we are going to explore some of its features.

How to do it...

The groovysh command is a command-line tool available with the standard Groovy distribution. Install Groovy as described in one of the installation recipes (see the Installing Groovy on Windows recipe and Installing Groovy on Linux and OS X recipe) and you'll get the groovysh command available in your shell:

  1. Open a shell on your operating system and type groovysh, as shown ...

Get Groovy 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.