exit.rst 869 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. exit command
  2. ============
  3. Synopsis
  4. --------
  5. ::
  6. exit
  7. Description
  8. -----------
  9. The exit command terminates a script started via the run or source command.
  10. If scripts are nested, only the innermost script is left.
  11. ::
  12. => setenv inner 'echo entry inner; exit; echo inner done'
  13. => setenv outer 'echo entry outer; run inner; echo outer done'
  14. => run outer
  15. entry outer
  16. entry inner
  17. outer done
  18. =>
  19. When executed outside a script a warning is written. Following commands are not
  20. executed.
  21. ::
  22. => echo first; exit; echo last
  23. first
  24. exit not allowed from main input shell.
  25. =>
  26. Return value
  27. ------------
  28. $? is default set to 0 (true). In case zero or positive integer parameter
  29. is passed to the command, the return value is the parameter value. In case
  30. negative integer parameter is passed to the command, the return value is 0.