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

 

 

...

The for statement repetitively executes a statement (®rst form) or a group of statements

next

 

(second form) under control of a named variable. The variable takes on the value of the

 

®rst 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 com-

 

mas. The ®rst of these is the initialization, the second is the test (true to continue), and the

 

third is the loop-continuation action (normally an increment).

 

fun f ( [a,

... ] ) [ v, ... ]

 

 

...

fun de®nes the function name, arguments, and local variables for a user-written function.

nuf

 

Up to ten arguments and local variables are allowed. Such names cannot be arrays, nor

 

can they be I/O associated. Function de®nitions cannot be nested. Calling an unde®ned

 

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 interrogation

 

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 constants

 

8, 10 (the default), and 16. Hexadecimal values 10-15 are entered as a-f. A leading digit

 

is required (i.e., f0a must be entered as 0f0a).

ibase (and obase discussed below)

 

are executed immediately.

 

 

if expression statement

 

 

if expression

 

 

...

 

 

 

[else...]

The statement (®rst form) or group of statements (second form) is executed if the expres-

fi

 

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

 

®rst 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 ®le name. The ®le must contain bs source statements.

 

Such statements become part of the program being compiled. include statements can-

 

not 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 ®rst 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 ®rst internal statement.

 

If the run statement is contained in a ®le, it should be the last statement.

 

Section 150

− 2 −

HP-UX Release 11i: December 2000