What are exit codes and how do you check them?
BeginnerConceptPackages, Shell & Text Tools
Answer
Every command returns 0 for success and 1–255 for failure. $? holds the last one. Conventions: 1 general error, 2 misuse, 126 not executable, 127 command not found, 128+N killed by signal N (137 = SIGKILL, often OOM; 143 = SIGTERM).
grep -q ERROR app.log; echo $?
cmd || { echo "cmd failed" >&2; exit 1; }
More on Packages, Shell & Text Tools
Compare apt and dnf package management.BeginnerWhat is the difference between `apt upgrade` and `apt full-upgrade`?IntermediateHow do you find which package provides a file or command?BeginnerHow do you pin or hold a package version?IntermediateHow are repositories and their GPG keys configured?AdvancedWhat is the difference between a login shell and an interactive non-login shell?Intermediate