HP-UX Reference (11i v2 04/09) - 1 User Commands A-M (vol 1)

b
bs(1) bs(1)
does not cause stored statements to execute (see
run below).
for name = expression expression statement
for name = expression expression
...
next
for expression , expression , expression statement
for expression , expression , expression
...
next The for statement repetitively executes a statement (first form) or a group of state-
ments (second form) under control of a named variable. The variable takes on the value
of the first expression, then is incremented by one on each loop, not to exceed the value of
the second expression. The third and fourth forms require three expressions separated
by commas. The first of these is the initialization, the second is the test (true to con-
tinue), and the third is the loop-continuation action (normally an increment).
fun f([a, ...]
) [v, ...]
...
nuf fun defines the function name, arguments, and local variables for a user-written func-
tion. Up to ten arguments and local variables are allowed. Such names cannot be
arrays, nor can they be I/O associated. Function definitions cannot be nested. Calling an
undefined function is permissible; see function calls below.
freturn A way to signal the failure of a user-written function. See the interrogation operator (
?)
below. If interrogation is not present,
freturn merely returns zero. When interroga-
tion is active,
freturn transfers to that expression (possibly by-passing intermediate
function returns).
goto name Control is passed to the internally stored statement with the matching label.
ibase n ibase sets the input base (radix) to n. The only supported values for n are the con-
stants
8, 10 (the default), and 16. Hexadecimal values 10-15 are entered as a-
f.A
leading digit is required (that is,
f0a must be entered as 0f0a). ibase (and obase
discussed below) are executed immediately.
if expression statement
if expression
...
[else...]
fi The statement (first form) or group of statements (second form) is executed if the expres-
sion evaluates to non-zero. The strings 0 and "" (null) evaluate as zero. In the second
form, an optional else provides for a second group of statements to be executed when
the first group is not. The only statement permitted on the same line with an
else is an
if; only other fis can be on the same line with a fi. The concatenation of
else and
if into an elif is supported. Only a single fi is required to close an if ...
elif ...
[
else ... ] sequence.
include expression
expression must evaluate to a file name. The file must contain bs source statements.
Such statements become part of the program being compiled. include statements
cannot be nested.
obase n obase sets the output base to n (see ibase above).
onintr label
onintr onintr provides program control of interrupts. In the first form, control passes to the
label given, just as if a goto had been executed at the time onintr was executed. The
effect of the statement is cleared after each interrupt. In the second form, an interrupt
causes bs to terminate.
return [expression]
The expression is evaluated and the result is passed back as the value of a function call.
If no expression is given, zero is returned.
run The random number generator is reset. Control is passed to the first internal statement.
If the run statement is contained in a file, it should be the last statement.
HP-UX 11i Version 2: September 2004 2 Hewlett-Packard Company Section 155