[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Normally radtest
stops parsing its command line
when it encounters either first non-optional argument
(i.e. the one not starting with dash), or an argument consisting
of two dashes. The rest of the command line starting from the
first non-optional argument forms positional parameters.
These parameters are said to form the top-level environment.
Similarly, when invoking a user-defined function (see section Function Definitions), arguments passed to it are said to form the current environment of the function. These arguments are positional parameters for this function.
Positional parameters are assigned numbers starting from 1. To access
(dereference) a positional parameter, the syntax $n
is used, where n is the number of the parameter. Alternative
forms, such as ${n}
or ${n:-text}
,
can also be used. These work exactly as described in
Dereferencing Variables).
The number of positional parameters can be accessed using a special
notation $#
.
Several things need to be mentioned:
string
data
type, whereas the types of positional parameters in a function
current environment are determined before inoking the function.
$0
returns the name of the function
being evaluated. When used in the top-level environment, it returns
the name of radtest
program as given by ‘--file’
(‘-f’) option.
AWK
programmers should note that assignments
(see section Assignment Options) are not included in the top level
environment (see example below).
For example, suppose you run:
radtest -f script.rad name foo=bar 5 |
Then, the top-level environment of program ‘script.rad’ consists of the following variables:
$0 ⇒ script.rad $1 ⇒ name $2 ⇒ 5 |
This document was generated by Sergey Poznyakoff on December, 6 2008 using texi2html 1.78.