cancel name
Terminate a specified user-defined command.
Keyword name
cancel
command to terminate a user-defined
command called foo
. If such a command is currently
running, then this makes the command end, as though the command
had executed a return
command. If the section of the script that was
running foo
is enclosed in
a catch
statement that uses
the $aborted()
function,
then the rest of that section of the script is also terminated.
cancel foo
cancel
command facilitates this,
provided that the schedule is written such that the statements of
each part that might need to be terminated interactively, are
encapsulated in individual user-defined commands. In cases where
terminating a particular command makes other surrounding commands
meaningless, the schedule writer can also arrange to terminate
those surrounding commands, by enclosing them within
a catch
statement whose
termination clause returns true
when
the aborted()
function
returns true
.
Note that any user-defined commands that are aborted in this way,
run any termination cleanup statements that were previously
registered to them by at_end
commands.