Next: Sample Radtest Program, Previous: Loops, Up: radtest [Contents][Index]
Getopt is used to break up command line options for
subsequent parsing.
The only mandatory argument, optstring is a list of short (one-character) options to be recognized. Each short option character in optstring may be followed by one colon to indicate it has a required argument, and by two colons to indicate it has an optional argument.
Each subsequent invocation of getopt processes next command
line argument. Getopt returns true if the argument is an
option and returns false otherwise. It stores the retrieved option
(always with a leading dash) in the variable opt (OPTVAR
by default). If the option has an argument, the latter is stored
in the variable arg (OPTARG by default). Index of the
next command line argument to be processed is preserved in the
variable ind (OPTIND by default).
The usual way of processing command line options is by invoking
getopt in a condition expression of while loop and
analyzing its return values within the loop. For example:
while getopt "hf:"
case $OPTVAR in
"-h") print "Got -h option\n"
"-f") print "Got -f option. Argument is " $OPTARG "\n"
".*") begin
print "Unknown option: " $OPTVAR "\n"
exit 1
end
end
end
Evaluates expr and prints its result on standard output. Then reads a line from standard input and assigns it to the variable name.
If expr is given, name must also be present.
If name is not given, variable INPUT is used by default.
Sets radtest command line options. Options should
be a valid radtest command line (see Invoking radtest).
Shift positional parameters left by one, so that $2 becomes
$1, $3 becomes $2 etc. $# is decremented.
$0 is not affected.
If expr is given, it is evaluated, converted to integer and
used as shift value. Thus shift 2 shifts all positional
parameters left by 2.
Returns from the current function (see Function Definitions). If expr is present, it is evaluated and the value thus obtained becomes the function return value.
It is an error to use return outside of a function definition.
Exit from within a loop.If n is specified, break from number levels. n must be >= 1. If n is greater than the number of enclosing loops, an error message is issued.
See Loops, for the detailed discussion of the subject.
Resume the next iteration of the enclosing loop. If n is specified, resume at the nth enclosing loop. n must be >= 1. If n is greater than the number of enclosing loops, an error message is issued.
See Loops, for the detailed discussion of the subject.
Exit to the shell. If expr is specified, it is evaluated and used as exit code. Otherwise, 0 is returned to the shell.
Evaluate and print expressions. Expr-list is whitespace or comma-separated list of expressions. Each expression is evaluated in turn and printed to the standard output.
Send a request to the RADIUS server and wait for the reply. Stores
reply code in the variable REPLY_CODE and reply A/V pairs in
the variable REPLY (see Interacting with Radius Servers).
flags are a whitespace-separated list of variable assignments. Following variables are understood:
repeat=nUnconditionally resend the request n times.
id=nSpecify the request ID.
keepauth=1Do not alter request authenticator when re-sending the request.
Specifies which port to use when sending the request. Use ‘auth’ to send the request to the authentication port (see auth-port), and ‘acct’ to send it to the accounting port (see acct-port).
RADIUS request code. Either numeric or symbolic (see Numeric Values).
Specifies the A/V pairs to include in the request. This argument is
either an expression evaluating to avlist, or an immediate
avlist (see Lists of A/V pairs). In the latter case, the parentheses
around the list are optional.
Test if REPLY_CODE matches code and, optionally, if
REPLY matches expr-or-pair-list. If so, print the
string ‘PASS’, otherwise print ‘FAIL’.
See Interacting with Radius Servers, for the detailed discussion of this statement.
Next: Sample Radtest Program, Previous: Loops, Up: radtest [Contents][Index]