Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Appendix A - Operators

The operators used in MPW expressions are organized in functional groups in the list below. The groups are listed in decreasing order of precedence; operators within groups have the same precedence.

Table A-1: MPW Operators

Grouping

(expr)

Groups expressions; overrides operator precedence

Negation

-

 

 

Unary negation

~

 

 

Bitwise negation

!

NOT

¬ (Option-l)  

Logical NOT

Multiplication and Division

*

 

 

Multiplication

÷ (Option-/)  

DIV

 

Division

%

MOD

 

Modulus division

Addition and Subtraction

+

 

 

Addition

-

 

 

Subtraction

Shift

<<

 

 

Shift left

>>

 

 

Shift right

Relational

<

 

 

Less than

<=

(Option-<)

 

Less than or equal to

>

 

 

Greater than

>=

(Option->)

 

Greater than or equal to

String

==

 

 

Equal

!=

<>

(Option-=)

Not equal

=~

 

 

Equal--regular expression ‡

!~

 

 

Not equal--regular expression ‡

AND and OR

(Operators within this group are listed in decreasing order of precedence.)

&

 

 

Bitwise AND

^ (Option-I)

 

 

Bitwise XOR

|

 

 

Bitwise OR

&&

AND

 

Logical AND

||

OR

 

Logical OR

†  The !, NOT, ¬, &&, AND, ||, and OR logical operators interpret null and zero operands as false and nonzero operands as true. Relational operators function in a similar manner, returning 0 when the relation is true, and 1 when it is false.

‡  The =~ and !~ pattern-matching operators match a regular expression right operand (enclosed in the delimiters /…/) with a left operand. Note that when evaluating an expression that uses a regular expression with the tagging operator ®, the MPW Shell creates variables of the form n}, containing the matched substrings for each ® operator.

 
 


Last Updated July 2000