summaryrefslogtreecommitdiff
path: root/doc/usage/cmd/exit.rst
blob: 3edb12809ce78fa310509b82155853d08eb2a438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
exit command
============

Synopsis
--------

::

    exit

Description
-----------

The exit command terminates a script started via the run or source command.
If scripts are nested, only the innermost script is left.

::

    => setenv inner 'echo entry inner; exit; echo inner done'
    => setenv outer 'echo entry outer; run inner; echo outer done'
    => run outer
    entry outer
    entry inner
    outer done
    =>

When executed outside a script a warning is written. Following commands are not
executed.

::

    => echo first; exit; echo last
    first
    exit not allowed from main input shell.
    =>

Return value
------------

$? is default set to 0 (true). In case zero or positive integer parameter
is passed to the command, the return value is the parameter value. In case
negative integer parameter is passed to the command, the return value is 0.