quit [expression]
¶quit [expression [subshell-levels]]
q
To exit the BASH debugger, use the quit
command (abbreviated
q
), or type an end-of-file character (usually C-d). If
you do not supply expression, the BASH debugger will try to terminate
normally or with exit code 0. Otherwise it will terminate using the
result of expression as the exit code.
A simple quit
tries to terminate all nested subshells that may
be in effect. If you are nested a subshell, this is normally
indicated in a debugger prompt by the number of parentheses that the
history number is inside — no parenthesis means there is no subshell
in effect. The dynamic variable BASH_SUBSHELL
also contains the
number of subshells in effect.
If you want only to terminate some number of subshells but not all of
them, you can give a count of the number of subshells to leave after
the return-code expression. To leave just one level of subshell
return
does almost the same thing. (See see Returning) There is a subtle difference between the two though:
return
will leave you at the beginning of the next statement
while quit
may leave you at the place the subshell was invoked
which may be in the middle of another command such as an assignment
statement or condition test.
If the environment variable _Dbg_QUIT_ON_QUIT
is set, when the
program terminates, the debugger will also terminate too. This may be
useful if you are debugging a script which calls another script and
you want this inner script just to return to the outer script.
kill
k
In situations where quit
doesn’t work we provide an alternative
and more forceful quit command: kill
. This sends to the OS
non-maskable KILL signal with the debugger process number. No cleanup
of temporary files is done by the program.