Until (u)

until

Syntax:

[line_range]ucount  more_editor_commands

[line_range]ucondition  more_editor_commands

[line_range]ucount[condition]  more_editor_commands

[line_range]u more_editor_commands

Description:

This command is used to repeat a list of commands a number of times until a given condition is satisfied. The list of commands may contain another Until if desired, however, it may not contain a Branch (b) command. The space between the count or condition and more_editor_commands is required.

The first form will repeat the list of commands count times.

The second form will set the condition register to the opposite of condition and repeat the entire list of commands until the condition register matches condition at the end of one of the repetitions of the command list. The condition should be specified as a single character which may be t for TRUE or f for FALSE.

The third form will set the condition register as in the second form but will repeat the list until either count is reached, or the condition register matches condition, whichever occurs first.

The final form will repeat forever, or until you type Break (or an error occurs).

In all cases the Until command will terminate immediately if any command in the list generates an error. In this case the condition register will be in the state it had before the error. The error will not be printed, but absorbed by the Until command. This allows you to prevent a command from issuing an error message by preceding it with a u1  . For example:

u1  s/IBM/I.B.M/

will not generate an error if the substitute fails.

If both count and condition are omitted, then the Until will repeat until an error occurs or you type Ctrl-Break.

Current line:

When the Until command is finished, the current line will have the value it had after the last command executed during the Until operation.

Condition register:

When the Until command is finished, the condition register will have the value it had after the last command executed during the Until operation.