Name

catch — Evaluates a script, catching any errors.

Synopsis

catch script [varname]

Description

The catch command evaluates a script, and returns 0 if the script evaluated successfully. If there were errors, catch returns 1. Optionally, a variable name may be passed to the command, where the results of the script evaluation will be placed. In the case of errors, the stack trace will be placed in the variable argument. If the script executes without problems, the variable will contain the result of the script execution.

Example

catch nosuchcommand foo
set foo
	  

Produces:

	  {ERROR {Command nosuchcommand does not exist}}