Heinrich Schuchardt | 1b0c316 | 2024-01-14 14:53:13 +0100 | [diff] [blame^] | 1 | .. index:: |
| 2 | single: exit (command) |
| 3 | |
Heinrich Schuchardt | 172279a | 2021-01-20 12:14:01 +0100 | [diff] [blame] | 4 | exit command |
| 5 | ============ |
| 6 | |
| 7 | Synopsis |
| 8 | -------- |
| 9 | |
| 10 | :: |
| 11 | |
| 12 | exit |
| 13 | |
| 14 | Description |
| 15 | ----------- |
| 16 | |
| 17 | The exit command terminates a script started via the run or source command. |
| 18 | If 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 | |
| 30 | When executed outside a script a warning is written. Following commands are not |
| 31 | executed. |
| 32 | |
| 33 | :: |
| 34 | |
| 35 | => echo first; exit; echo last |
| 36 | first |
| 37 | exit not allowed from main input shell. |
| 38 | => |
| 39 | |
| 40 | Return value |
| 41 | ------------ |
| 42 | |
Marek Vasut | fd09932 | 2022-12-20 07:25:59 +0100 | [diff] [blame] | 43 | $? is default set to 0 (true). In case zero or positive integer parameter |
| 44 | is passed to the command, the return value is the parameter value. In case |
| 45 | negative integer parameter is passed to the command, the return value is 0. |