HP StorageWorks SAN Virtualization Services Platform Manager Command Line Interface User Guide (5697-0936, May 2011)

This command instructs the CLI executor to go to Label. Note that the line with the label in the
script file must always come after the line of the GoTo command. Label is not case sensitive, and
must not contain white spaces. The label location must appear at the beginning of a line immediately
followed by a colon (:).
A GoTo command without a label is simply ignored, but it still clears any previous label set by an
OnErrorGoTo command.
A GoTo command (even if empty or without a label) clears any previous label set by an
OnErrorGoTo command (that is, after the GoTo command is executed, no previous
OnErrorGoTo command is in effect).
To exit the script file, put the label at the end of the script file (as the last line), or do not add
the label at all (but this may cause confusion about the original intention of the script writer).
A best practice would be to have the last line of a script always contain and terminating label
of some kind. For example, when using an input command file with multiple OnErrorGoTo
commands, include a Quit command with a message that is appropriate for the error
condition.
OnErrorGoTo command
Syntax
OnErrorGoTo Label
Description
The OnErrorGoTo CLI command can be used only in script files (that is, when the -I argument is
used). This command is used to change the sequence of executed CLI commands when one of the
commands returns with an error. Also, this command instructs the CLI executor to disable (deactivate)
the error trapping mechanism.
This command instructs the CLI executor to go to Label if the execution of a subsequent CLI
command returns with an error. Note that the line with the label in the script file must always come
after the line of the OnErrorGoTo command. Label is not case sensitive, and must not contain
white spaces. The label location must appear at the beginning of a line immediately followed by
a colon (:).
For consecutive calls to OnErrorGoTo with different labels, change the label after each call,
so that the label of the most recent call is always in effect.
If an error occurs while the error trapping mechanism is active, the CLI executor searches for
the first occurrence of the appropriate label and ignores all commands, including another
OnErrorGoTo command, up to the label (or the end of file if the label is not found).
To exit the script file in case of an error, put the label at the end of the script file (as the last
line), or simply do not add the label at all (but this may cause confusion about the original
intention of the script writer).
As an example:
OnErrorGoTo firstLabel
# now firstLabel is in effect
. . .
OnErrorGoTo MyLabel
# now MyLabel is in effect
. . .
firstLabel:
# label is ignored during normal processing (when no error occurs)
CLI command guidance 21