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