Using GroovyShell as “expression evaluator/engine” (or: How to reuse GroovyShell)
问题 I'm using GroovyShell as an "expression evaluator/engine" inside my program. It accepts two inputs: (a) one or more init scripts (b) user-defined script. Both are then concatenated at runtime as big chunk of script (text) and feed to the shell. String initScripts = getFromDB() String userScript = getFromUser() def shell = new GroovyShell() output = shell.evaluate(initScripts + userScript) The above code will run in a loop, where the contents of userScript will vary. So far, initScripts only