Well, I posted perhaps a moment too soon. Using BBEdit as a scratchpad isn’t going to be quite so tidy, since groovy cares deeply about the name of the file which contains the script. I had noticed this earlier when I named my version of “Hello World” as ‘hello-world.groovy’: when I ran it I got an error because ‘hello-world’ is not a legal Java identifier. Renaming it to “helloWorld.groovy” was all it took. But then when I pasted in some regular expression code into the file and tried running it without saving it, I got something like this:
/opt/groovy/bin/groovy: line 45: [: too many arguments Exception in thread "main" java.lang.ClassFormatError: 2532143 (Illegal Class name "2532143")
Just saving the file was all it took, but little things like that make it less suitable for a scratchpad. Oh well. I’ve been meaning to give Eclipse another shot anyway.
If you make sure your file has unix line ends and you (once) hold down the command key and choose “Run…” from the #! menu and turn on auto save before running, BBEdit shouldn’t need to create temp files to run your script.