$RodHat_/search
exit code reference

Exit 126

The command was found but could not be executed.

Value
126
Convention
Shell and tool convention

Bash gives 126 when the file exists but cannot be run: no execute bit, a directory, or a mount that forbids execution. The underlying errno is usually EACCES. Check permissions and whether the filesystem is mounted noexec before you suspect the program itself.

What to check

ls -l ./script; findmnt -T ./script -o TARGET,OPTIONS

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.