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

MPW Command Reference


Begin…End

Built-in

SYNTAX

Begin
  command
End

DESCRIPTION

The Begin…End control structure groups commands for pipe specifications, conditional execution, and redirection. Commands must be separated by either carriage returns or semicolons.

If you use an operator for pipe specification (|), conditional execution (&& and ||), or redirection (<, >, >>, ≥, ≥≥, ∑, ∑∑), the operator must appear after End and applies to all of the enclosed commands, if they are not themselves redirected.

Note
The Begin and End delimiters behave like left and right parentheses. Once Begin has been executed, the MPW Shell does not execute any of the subsequent commands until it encounters an End, so that redirection operators can be processed. •

INPUT

None

OUTPUT

None

STATUS

Begin…End returns the status code of the last command executed. If no commands appear between Begin and End, it returns 0.

PARAMETERS

command…

Specifies the commands grouped by Begin…End. Separate commands with either carriage returns or semicolons.

OPTIONS

None

EXAMPLES

The following commands save the current definitions of all variables, exports, aliases, and menus in the SavedState file.

Begin
  Set
  Export
  Alias
  AddMenu
End > SavedState

Notice that the output specification following End applies to all the commands within Begin…End. This is identical to the following:

(Set; Export; Alias; AddMenu) > SavedState

The Set, Export, Alias, and AddMenu commands write their output in the form of commands. For instance,

Alias Dir Directory

shows that Dir is a command alias for the Directory command.

These commands can be executed to redefine variables, exports, command aliases, and menus, respectively. Therefore, upon executing the grouped commands, the command line

Execute SavedState

restores all these definitions. You must execute the script so that the variables and command aliases apply to the current scope.

Note
This technique is used in the Suspend script to save state information. The Resume file runs the file that Suspend creates, restoring the various definitions, reopening the windows, and resetting the current directory. •

SEE ALSO

The Suspend script located in your {MPW} folder.

 
 


Last Updated July 2000