Products Applications Downloads Features Wiki forum Store

args Command

From Wiki077
Jump to: navigation, search


args [options] [arguments]

This command will parse command line options and arguments into local variables, making a script more readable, by avoiding the numbered argument variables: $arg1, $arg2, etc.

Options

Examples

Consider a DAT named text1 with the following command:

args "-p oppath" "-q quality" red greed blue

Executing 'run dat1 -p /project1 -q 95 0.1 0.2 0.3', will cause the above args command to set the following local variables:

$oppath = "/project1"
$quality = "95"
$red = "0.1"
$green = "0.2"
$blue = "0.3"

In addition, the following local variables will be set, signifying those particular options were specified:

$_q = "1"
$_p = "1"

Note that options are optional and can be any length of letters, and specified in any order. For example, executing 'run dat1 -p /project1 0.1 0.2 0.3', would still set $oppath, $red, $green, $blue, but would set $quality to "" and $_q to "" as they were not specified.

See Also

arg(), argc(), argf(), argfx(), argx(), argxc(), parse Command

Personal tools