Chat now with support
Chat with Support

Safeguard for Sudo 2.0 - Administrators Guide

One Identity Privileged Access Suite for Unix Introducing Privilege Manager for Unix Introducing Privilege Manager for Sudo Planning Deployment Installation and Configuration
Download Privilege Manager for Unix Software Packages Download Privilege Manager for Sudo Software Packages Quick Start and Evaluation Configure a Primary Policy Server Configure a Secondary Policy Server Install PM Agent or Sudo Plugin on a Remote Host Remove Configurations
Upgrading Privilege Manager System Administration Managing Security Policy The Privilege Manager for Unix Security Policy Advanced Privilege Manager for Unix Configuration Administering Log and Keystroke Files InTrust Plug-in for Privilege Manager Troubleshooting Privilege Manager for Unix Policy File Components Privilege Manager Variables Privilege Manager for Unix Flow Control Statements Privilege Manager for Unix Built-in Functions and Procedures Privilege Manager Programs Installation Packages Unsupported Sudo Options Sudo Plugin Policy Evaluation About us

do-while

Syntax
do statement while ( expression ) ;
Description

The do-while statement is a looping statement. It repeatedly executes the specified statement until the specified expression evaluates to false (the value 0) or it encounters a break statement.

NOTE: The specified statement executes at least once (unlike the while statement, which may terminate immediately).

Use a statement block in the form { statement ... } to execute multiple statements in the loop. Quest recommends using a statement block for readability.

Examples

This prints the values 1,2,3,4,5:

x=1; 
do print(x++); while (x <= 5);

This prints the values 1,2,3,4,5 using a statement block:

x = 1; 
do { 
   print(x); 
   x++; 
} while (x <= 5);

This prints the values 1,2,3 because the break statement terminates the loop:

x=1; 
do { 
   if (x > 3) break; 
   print(x++); 
} while (x <= 5);

for loop

Syntax
for ( 
      initializer statements ; 
      conditional expression ; 
      update expression ;
      initializer statements ; 
      conditional expression ; ) 
   statement
Description

The for statement is a looping statement. It executes one or more initializer statements and then evaluates the conditional expression. Use a comma to separate multiple initializer statements. If the conditional expression evaluates to true (any non-zero value), then it executes the specified statement. It executes the update expression (if present) immediately after it executes the specified statement. The for statement is terminated if the conditional expression evaluates to false (the value 0), or it encounters a break statement.

Typically, a for statement contains one initializer statement, a conditional expression, and an update expression that all operate on the same variable.

Use a statement block in the form { statement ... } to execute multiple statements. Quest recommends using a statement block for readability.

Examples

This prints the values 1,2,3,4,5:

for (x = 1; x <= 5; x++) print(x);

This prints the values 1,2,3,4,5. (Note that this example does not have an update expression and it uses a statement block):

for (x = 1; x <= 5; ) { 
   print(x); 
   x++; 
}

This prints the values 1,2,3 because the break statement terminates the loop:

for (x = 1; x <= 5; x++) { 
   if (x > 3) break; 
   print(x); 
}

for loop

Syntax
for (variable in expression ) statement
Description

The for statement is a looping statement. The specified expression must be an array. It executes the specified statement once for each array element, and assigns it to the specified variable in turn. The for statement terminates when the specified expression does not evaluate to an array value, either when each element of the array has been iterated, or it encounters a break statement.

Use a statement block in the form { statement ... } to execute multiple statements. Quest recommends using a statement block for readability.

Examples

This prints the values 1,2,3,4,5:

for (x in {1,2,3,4,5}) print(x);

This does not print any value, since the expression does not evaluate to an array:

for (x in "foo") print(x);

This prints the values 1,2,3 because the break statement terminates the loop:

values = {1,2,3,4,5}; 
for (x in values) { 
   if (x > 3) break; 
   print(x); 
}

function

Syntax
function ( parameter = expression, ... ) { statement ... }
Description

See procedure / function for a full description of function.

Related Documents