Quick answer

Understand why commands return non-zero status, how to check $?, and how exit codes help debug scripts.

Exit Codes is a focused guide for the exact situation described below.

For Exit Codes, focus on Termux packages and Android integration and use the output to decide the next small fix instead of reinstalling everything.

What to check

Copyable command

For Exit Codes, replace placeholders only when they appear in the command.

python script.py
echo $?
command_that_might_fail || echo "command failed"

Read the output

  1. python script.py — runs the script directly so the first traceback can be read for Exit Codes.
  2. echo $? — checks the part of the Termux packages and Android integration workflow that usually causes this issue for Exit Codes.
  3. command_that_might_fail || echo "command failed" — checks the part of the Termux packages and Android integration workflow that usually causes this issue for Exit Codes.

Fix in a safe order

  1. Save the Exit Codes output before editing files.
  2. Change one thing at a time while testing Exit Codes.
  3. If the Exit Codes error changes, read the new clue instead of repeating the old fix.

Common mistakes

Guide did not solve it?

If exit codes the package or Android integration still fails, use the Store and include your Android version, Termux source, and the error.

Open Store / Get Help

Related Assistance pages