blob: 2f250bf4bde834b8d3ee339973e3a64777b919b6 [file] [log] [blame]
Heinrich Schuchardt1b0c3162024-01-14 14:53:13 +01001.. index::
2 single: exit (command)
3
Heinrich Schuchardt172279a2021-01-20 12:14:01 +01004exit command
5============
6
7Synopsis
8--------
9
10::
11
12 exit
13
14Description
15-----------
16
17The exit command terminates a script started via the run or source command.
18If scripts are nested, only the innermost script is left.
19
20::
21
22 => setenv inner 'echo entry inner; exit; echo inner done'
23 => setenv outer 'echo entry outer; run inner; echo outer done'
24 => run outer
25 entry outer
26 entry inner
27 outer done
28 =>
29
30When executed outside a script a warning is written. Following commands are not
31executed.
32
33::
34
35 => echo first; exit; echo last
36 first
37 exit not allowed from main input shell.
38 =>
39
40Return value
41------------
42
Marek Vasutfd099322022-12-20 07:25:59 +010043$? is default set to 0 (true). In case zero or positive integer parameter
44is passed to the command, the return value is the parameter value. In case
45negative integer parameter is passed to the command, the return value is 0.