b

bs(1)

bs(1)

++ name

Increments the value of the variable (or array reference). The result is the new value.

- - name

Decrements the value of the variable. The result is the new value.

!expression

The logical negation of the expression. Watch out for the shell escape command.

expression

operator expression Common functions of two arguments are abbreviated by the two argu-

 

ments separated by an operator denoting the function. Except for the assignment, concate-

 

nation, and relational operators, both operands are converted to numeric form before the

 

function is applied.

Binary Operators (in increasing precedence):

== is the assignment operator. The left operand must be a name or an array element. The result is the right operand. Assignment binds right to left, all other operators bind left to right.

_

_ (underscore) is the concatenation operator.

&

& (logical AND) has result zero if either of its arguments are zero. It has result one if both

 

of its arguments are non-zero; (logical OR) has result zero if both of its arguments are

 

zero. It has result one if either of its arguments is non-zero. Both operators treat a null

 

string as a zero.

< <=

> >= == !=

 

The relational operators (<: less than, <=: less than or equal, >: greater than, >=:

 

greater than or equal, ==: equal to, !=: not equal to) return one if their arguments are in

 

the speci®ed relation, or return zero otherwise. Relational operators at the same level

 

extend as follows: a>b>c is equivalent to a>b & b>c. A string comparison is made if

 

both operands are strings.

+ -

Add and subtract.

* / %

Multiply, divide, and remainder.

ÃExponentiation.

Built-in Functions:

Dealing with arguments

arg(i) is the value of the i-th actual parameter on the current level of function call. At level zero, arg returns the i-th command-line argument (arg(0) returns bs).

narg( ) returns the number of arguments passed. At level zero, the command argument count is returned.

Mathematical

abs(x) is the absolute value of x.

atan(x) is the arctangent of x. Its value is between −π/2 and π/2.

ceil(x) returns the smallest integer not less than x.

cos(x) is the cosine of x (radians).

exp(x) is the exponential function of x.

floor(x) returns the largest integer not greater than x.

log(x)

is the natural logarithm of x.

rand( ) is a uniformly distributed random number between zero and one.

sin(x) is the sine of x (radians).

sqrt(x) is the square root of x.

String operations

size(s) the size (length in bytes) of s is returned.

format(f, a)

 

returns the formatted value of a. f is assumed to be a format speci®cation in the style of

 

printf(3S). Only the % ... f, % ... e, and

% ... s types are safe. Since it is not always

Section 152

− 4 −

HP-UX Release 11i: December 2000