1exit(n)                      Tcl Built-In Commands                     exit(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       exit - End the application
9

SYNOPSIS

11       exit ?returnCode?
12______________________________________________________________________________
13
14

DESCRIPTION

16       Terminate  the  process, returning returnCode to the system as the exit
17       status.  If returnCode is not specified then it defaults to 0.
18

EXAMPLE

20       Since non-zero exit codes are usually interpreted as error cases by the
21       calling  process,  the  exit  command is an important part of signaling
22       that something fatal has gone wrong. This code fragment  is  useful  in
23       scripts to act as a general problem trap:
24
25              proc main {} {
26                  # ... put the real main code in here ...
27              }
28
29              if {[catch {main} msg options]} {
30                  puts stderr "unexpected script error: $msg"
31                  if {[info exists env(DEBUG)]} {
32                      puts stderr "---- BEGIN TRACE ----"
33                      puts stderr [dict get $options -errorinfo]
34                      puts stderr "---- END TRACE ----"
35                  }
36
37                  # Reserve code 1 for "expected" error exits...
38                  exit 2
39              }
40

SEE ALSO

42       exec(n)
43

KEYWORDS

45       abort, exit, process
46
47
48
49Tcl                                                                    exit(n)
Impressum