Model situation: complex bash script has failed with some non-obvious exit code while the subsequent runs are as expected (i.e., intermittent error or something of that kind) Solution #1: quick web search Solution #2: study all the functions and program invocations on all/guessed code paths wrt. their return codes (not always properly documented!) + add some bash runtime considerations Solution #3: grep this document and pray it will help you :) 2 * bash:* - incorrect use of builtins $ [ bash: [: missing `]' 126 * bash - command found but not executable $ /etc bash: /etc: Is a directory 127 * general - cannot dynamically link in run-time (TODO: who is responsible here, exactly?): $ ./testfoo ./testfoo: error while loading shared libraries: libgetfoo.so: cannot open shared object file: No such file or directory * bash - unknown function/command $ foo bash: foo: command not found * bash:wait - waiting for nonexistent process/job $ /bin/true & { sleep 1; wait $(($! - 1));} bash: wait: pid 2864 is not a child of this shell 254 * bash - when cannot fork so as to perform the command due to hitting number of user processes limit, it will (IIUIC, first it will keep looping over emitting "fork: retry: No child processes" and "fork: Resource temporarily unavailable" messages, until it is eventually able to do a fork to get outside of this loop, and then it will...) will yield such exit status: $ ulimit -u $(($(ps --no-headers -mu $(id -u) | wc -l) + 1)) $ sleep 1 & sleep 1 bash: fork: retry: No child processes bash: fork: retry: No child processes bash: fork: retry: No child processes bash: fork: retry: No child processes bash: fork: Resource temporarily unavailable [...] bash: fork: retry: No child processes bash: fork: retry: No child processes bash: fork: retry: No child processes bash: fork: retry: No child processes - see also [1] - bash code perspective: jobs.c: last_command_exit_value = EX_NOEXEC; /** exit_value = EX_NOEXEC = 126 **/ throw_to_top_level (); /* Reset signals, etc. */ /** exit_value = 126 | 128 = 254 **/ [1] http://unix.stackexchange.com/questions/19113/fork-negative-return-value/19119#19119