Skip to Content.
Sympa Menu

grouper-dev - [grouper-dev] gsh script with arguments

Subject: Grouper Developers Forum

List archive

[grouper-dev] gsh script with arguments


Chronological Thread 
  • From: "Redman, Chad" <>
  • To: "" <>
  • Subject: [grouper-dev] gsh script with arguments
  • Date: Fri, 29 Mar 2019 13:57:46 +0000

Is it possible to run groovy gsh with a startup script that has arguments? It may just need to call the Groovy Shell constructor and bind the args as a variable.

 

I wanted to ask before filing a jira, in case there a history of beanshell running a different way. The groovy profile suggests that multiple command line parameters are to load multiple scripts in order. But it's only ever passed the first parameter, so it may not work as intended.

 

Even just a regular :load and passing parameters is challenging. This is the only way I know to get it to work:

 

def binding = new Binding()

binding.args = ["filename-placeholder", "a", "b", "c"]

def ret = new GroovyShell(binding).evaluate(new File("script.gsh"))

 

 

-Chad

 




Archive powered by MHonArc 2.6.19.

Top of Page