Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of exit status 1 returned by linux command

What is meaning of exit status 1 returned by linux command? Like 127 exit status indicates "command not found".

I have visited http://linux.die.net/abs-guide/exitcodes.html page, does it mean exit status 1 does not have particular special meaning?

like image 334
user2664054 Avatar asked Jan 07 '14 07:01

user2664054


People also ask

What does an exit status of 1 mean?

Exit status 1 is used in some error messages to indicate that a process has finished (or “exited”) in failure. Other parts of the error message will often contain more specific information. Your error output may end with one of these lines: Compilation error: exit status 1 .

What is exit 1 in shell script?

On the basis of above, exit(1) is used as one of the standard error codes which Catches all general errors when checked for the last run command. So any status which is not 0 is considered as failures in shell ,when we want shell script to come out in case of any further we use exit 1(exit with status code 1).

What is exit code minus 1?

Exit Failure: Exit Failure is indicated by exit(1) which means the abnormal termination of the program, i.e. some error or interrupt has occurred.

What is exit status 2 Linux?

Exit code 2 signifies invalid usage of some shell built-in command. Examples of built-in commands include alias, echo, and printf.


1 Answers

The only general convention is that a zero exit status signifies success, whereas any non-zero exit status is a failure.

Many -- but certainly not all -- command-line tools return exit code 1 for syntax error, i.e. you had too few arguments or an invalid option.

Many -- but, alas, not all -- command-line tools have a manual page. By convention, it should document the exit codes of the program, but many do not.

like image 80
tripleee Avatar answered Oct 05 '22 19:10

tripleee