an example compileAndGo script using JavaScript

Wrap JavaScript code in a compileAndGo script, as in the example below. Once-only compilation is automatic; the executable file is cached; source and invocation script are both in the one file.


1 Z% ./jshello 'folks of World'
Hello, folks of World!
2 Z% 

Here’s the cgo script.

#!/usr/bin/env compileAndGo
language = javascript
compiler = jsc

// Or you can use java.lang.System.out.println()
     "Hello, "
   + (arguments.length > 0 ? arguments[0] : "World")
   + "!")

(“Hello, folks of World!” is the Goon Show variant of “Hello, world!”)

http://Yost.com/computers/compileAndGo/cgo.html - this page
2004-08-04 Created
2005-11-06 End the header with !# per compileAndGo 5.0