$RodHat_/search
exit code reference

Exit 127

Command not found.

Value
127
Convention
Shell and tool convention

Bash returns 127 when the lookup fails: not in PATH, or a typo. The nasty variant is a script whose shebang names an interpreter that does not exist: the file is there, the shell says "not found", and you stare at a file you can see. Cron and systemd units run with a minimal PATH, so a command that works in your login shell often returns 127 there.

What to check

command -v name; head -1 script; echo "$PATH"

The errno behind it

Sources

  1. Exit Status, GNU Bash manual

Exit codes are conventions, not guarantees: a program can return any value from 0 to 255. Spot one that's wrong? Tell Rod.