| Applying science to business management |
  
Passing Command-line Arguments
It is sometimes useful to pass values to your script when it
is started. You do this by placing a question mark after the
script name and appending a list of values. For example, change a
link to your script from
<a
href="myscript.dsb">Run Script</a>
to
<a href="myscript.dsb?arguments">Run
Script</a>
In the script, you can retrieve the arguments
text using the expression
env("Query String")
If the argument text contains more than one value, use the tolist primitive to parse it into
individual argument values. For example, if you start a script
with the command
myscript.dsb?23&45&67
then
tolist(env("Query
String"),"&")
will produce the list [23,45,67]. Each of the list elements is
a text string instead of a number. If you want to convert input
argument text to numeric values, use tonumber.
Note: Never use eval
to convert argument text to numbers because this creates a
security flaw. If your script contains a statement such as eval(env("Query String"))
users can get your script to execute any command they wish simply
by calling it with the command as an argument value.
|