So there are lots of great scripting languages out there that offer a lot over plain old shell scripting. If you know java then groovy is very close and a good option but there is the alternative to write pure java by running the source with runjava (below) or embedding it into a bash script like example.sh.
If you want to run java source in a separate file then use runjava. For example:
Example.java:
import java.io.*;
import java.text.*;
import java.util.*;
public class Example {
public static void main(String[] args) throws Exception {
System.out.println("Hello " + args[0] + "!");
}
}
Run it like this (passing dave
as an argument):
$ ./runjava Example.java dave
Hello dave!
On my i7 desktop it takes 0.8 seconds to run (compile and execute). Same startup lag as groovy (which you would expect!).
example.sh is a bash script that has Example.java embedded in it. It is designed to be run with a linux/unix bash shell.
The script is run by entering ./example.sh at the command line.