Thanks very much, David! That's great help.
 
-Sophie

David Esterkin <desterkin@chariotsolutions.com> wrote:
Sophie Wang wrote:
> Hello,
> I intend to write input parameter for a beanshell script. It sounds like
> the args[] for Java or C. Does beanshell provide this solution?
>
> Thanks,
> Sophie
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Express yourself with Y! Messenger! Free. Download now
> .
>
Sophie,

Take a look at bsh.args:
http://www.beanshell.org/manual/bshmanual.html#Special_Variables_and_Values

-------------- argscript.bsh --------------
for (i=0; i print("Arg " + i + ": " + bsh.args[i]);
}
-------------- argscript.bsh --------------


Execute this from the commandline:

java -cp bsh.jar bsh.Interpreter zero one two three four

Output:

Arg 0: zero
Arg 1: one
Arg 2: two
Arg 3: three
Arg 4: four


Hope this helps,

David


Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.