5.33.10.2 Return Values

The return code of a Tcl command is a string. You can use a return value as an argument to another function by enclosing the command with square brackets [ ].

Example:

set a [ prog arg1 arg2 ] exec $a

The Tcl command “exec” will run an external program. The return value of “exec” is the output (on stdout) from the program.

Example:

set tmp [ exec myprog ] puts stdout $tmp