Relational Operators

The Privilege Management for Unix and Linux Security Policy Scripting Language supports a standard set of relational operators.

Operator Description
== Equal To
> Greater Than
>= Greater Than or Equal To
< Less Than
<= Less Than or Equal To
!= Not Equal To

Equal To Operator

The Equal operator ( == ) compares two values. If the first value is equal to the second value, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

if (UserCount == 10) reject;

If UserCount is equal to 10, the current task request is rejected.

Greater Than Operator

The Greater Than ( > ) operator compares two values. If the first value is greater than the second value, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

if (UserCount > 10) reject;

If UserCount is greater than 10, the current task request is rejected.

Greater Than or Equal To Operator

The Greater Than or Equal To ( >= ) operator compares two values. If the first value is greater than or equal to the second value, then an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

In this example, if UserCount is greater than or equal to 10, then the current task request is rejected.
if (UserCount >= 10) reject;

Less Than Operator

The Less Than operator ( < ) compares two values. If the first value is less than the second value, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

if (UserCount < 10) reject;

If UserCount is less than 10, the current task request is rejected.

Less Than or Equal To Operator

The Less Than or Equal operator ( <= ) compares two values. If the first value is less than or equal to the second value, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

if (UserCount <= 10) accept;

If UserCount is less than or equal to 10, the current task request is accepted.

Not Equal To Operator

The Not Equal To operator ( != ) compares two values. If the first value is not equal to the second value, an integer value of 1 (true) is returned. Otherwise, an integer value of 0 (false) is returned.

if (UserCount != 10) reject;

If UserCount is not equal to 10, the current task request is rejected.