Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3


Provides a shell-like capability for handling external processes.

Module Overview

Groosh is a Unix like shell written in Groovy. It has also been known as the Process Module but was renamed (back) when it was updated to work with Groovy 1.0.

The current version of Groosh is 0.3.6

Team Members

  • Yuri Schimke - Founder and original contributor
  • Alexander Egger [alexander.egger at] - Current maintainer



Source code and binary releases are available at

Groosh can be used via Grapes.

Note: If Ivy (Grapes) can not download Groosh add the file

Code Block

to your

Code Block

directory with the following content:

Code Block
  <property name="ivy.checksums" value=""/>
  <settings defaultResolver="downloadGrapes"/>
    <chain name="downloadGrapes">
      <filesystem name="cachedGrapes">
        <ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
        <artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      <!-- todo add 'endorsed groovy extensions' resolver here -->
      <ibiblio name="codehaus" root="" m2compatible="true"/>
      <ibiblio name="ibiblio" m2compatible="true"/>
      <ibiblio name="java.net2" root="" m2compatible="true"/>

There seams to be some problem with checksums generated by Maven 2.2.1


No installation required. Groosh can be added to Groovy using Grapes.

Try the following script to check if it worked:

Code Block

import groosh.Groosh

ls() >> stdout


Groosh is based on Groovy 1.7.0 or higher.


The following example shows Groosh in action:

Code Block
//Read a text file and write it to stdout

import groosh.Groosh

cat('test_scripts/blah.txt') >> stdout

Another example :

Code Block
//Count the lines of all .java files in this directory and all its subdirectories.
//Write the total number of lines to stdout.


import groosh.Groosh

def f = find('.', '-name', '*.java', '-ls')
def total = 0
def lines = grid { values,w ->
  def x = values[2,4,6,10]
  def s = x.join('	')
  total += Integer.parseInt(values[6])

f | lines
lines >> stdout
println "Total: ${total}"

Sometimes the name of a shell command conflicts with a Groovy method (for example ''grep''). This means that

Code Block

does not execute the shell command, but the Groovy method grep(...).

As a workaround for that you may prefix any shell command with _ this means the example above becomes

Code Block

The following example shows a more elaborate example. It uploads photos to a flickr account using the command line tool flickcurl. A photo set of this images is created and named after the current directory.

Code Block
import static groosh.Groosh.groosh
import static

ids = [:]
shell = groosh()

//get all images in this folder and upload it to flickr
//remember the photo id we get from flickr*jpg/).each {
  println "Uploading file $it to flickr"
  flickcurl = shell.flickcurl("upload",it,"friend","family").useError(true)
  id = flickcurl.grep(~/.*Photo ID.*/)[0].split(":")[1].trim()
  ids[it] = id
  println "Photo ID is: $id"
//we need to know the first photo id
firstKey = ids.keySet().toList()[0]

//create a set with the name of the directory we are in right now
//use the id of the first photo as set cover
setName = shell.pwd().text.split("/")[-1]
println "Creating set: $setName"
flickcurl = shell.flickcurl("photosets.create",setName,setName,ids[firstKey]).useError(true)
id = flickcurl.grep(~/.*Photoset.*/)[0].split(" ")[2].trim()
println "Photoset ID is: $id"

//make a backup of the ids in a file for later reference
println "Writing ids to a file"
file = new File(shell.pwd().text.trim() + "/.flickrset")
file << "Photoset:" << id << "\n"
ids.each {
  file << it.key << ":" << it.value << "\n"    

//the first photo is already part of the photo set so lets remove it

//add the remaining photos to the photo set
ids.each {
  println "Adding photo to set at flickr: $it"
  shell.flickcurl("photosets.addPhoto",id,it.value) | devnull()

println "DONE"


Source Control

The Groosh source code is available from


Building with Netbeans

Open the Kenai project in Netbeans and run build.

Building without Netbeans

Check out the source from

Groosh uses Maven 2 for building. You have to have Maven 2 installed.
Just execute mvn in the groosh directory groosh gets build.


Please contact Alexander Egger [alexander.egger at] by e-mail.


For mailing lists, issue trackers, forums etc see