Meaning of exit status 1 returned by linux command

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 02:42:28

问题


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?


回答1:


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.




回答2:


You can see the value of the exit status using man.

Giving an example below:

man ls

Now search for string exit

Adding screen shot below:



来源:https://stackoverflow.com/questions/20965762/meaning-of-exit-status-1-returned-by-linux-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!