Linux return value after command line execution-error value __linux

Source: Internet
Author: User
Tags comparison table sql error sql error code

In the C language we started with, the main function in the int main () function of the last always add a return 0; As the returned value, we did not know what the meaning of this return value, we often use the normal function of the return value, when the function to perform a task, After the function has finished executing, it always returns an appropriate value to tell the performer what the function is performing

Under Linux, under Terminal, the console runs a command, and all commands at the end return a numeric value, which is the return value, and each return value corresponds to an error number, based on the error number we can roughly infer the execution of the function. In addition, under the terminal, there is a special environment variable $?, save the return value of the previous program, we can try:

[Root@oldpan ~]# ls
lnmp1.4  lnmp1.4.tar.gz  lnmp-install.log

[Root@oldpan ~]# echo $?
0

The above, through ECHO, performs the return value of LS, which is found to be 0, indicating that the command was executed successfully, that is, if $? If the value of a variable is not 0, it means that the previous command encountered an error during execution. We can try the LS a nonexistent file:

[Root@oldpan ~]# ls AAA
ls:cannot access aaa:no such file or directory

[Root@oldpan ~]# echo o $?
o 2

Obviously the return value here has changed to 2, which means there is a problem with the command execution above.

What if you think you need echo $ every time? More trouble we can put it in the prompt:

[Root@oldpan ~]# export ps1= "[\$?] ${PS1} "

[0][root@oldpan ~]# ls AAA
ls:cannot access aaa:no such file or directory

[2][root@oldpan ~]#    

The above command allows you to see the results of the last execution of the command's return value at the front of the prompt.
In addition, we can view the wrong message by perror this command:

$ perror 2
OS error code   2:  No such file or directory
Error Comparison table:
"OS error code 1:operation not permitted" "OS error code 2:no such file or directory" "OS error code 3:no such Process "" OS error code 4:interrupted system call "OS error code 5:input/output error" OS error code 6:no s    Uch device or address "OS error code 7:argument list too long" OS error code 8:exec format error "" OS error code 9:bad file Descriptor "" OS error code 10:no child processes "OS error code 11:resource temporarily "" OS error code 12:cannot allocate memory "" OS error code 13:permission denied "" OS error code 14:bad address " 
OS error code 15:block device required "OS error code 16:device or resource Busy" "OS error code 17:file exists" "OS error code 18:invalid cross-device link" "OS error code 19:no such device" "OS error code 20:not directory "" OS error code 21:is a directory "OS error code 22:invalid argument" "OS error code 23:too many open files in  System "" OS error code24:too Many open files "" OS error code 25:inappropriate IOCTL for device "" OS error code 26:text file Busy "" Os ER Ror code 27:file too large "" OS error code 28:no spaces left on device "OS error code 29:illegal seek" OS error Code 30:read-only File System "" OS error code 31:too many links "os error code 32:broken pipe" "OS error code 3 3:numerical argument out of domain "" OS error code 34:numerical result out of range "" OS error code 35:resource de Adlock avoided "" OS error code 36:file name too long "OS error code 37:no locks available" "OS error code 38:fun Ction not implemented "" OS error code 39:directory not empty "OS error code 40:too many of levels links" " OS error code 42:no message of desired type "OS error code 43:identifier removed" "OS error code 44:channel numb  Er out of range "" OS error code 45:level 2 synchronized "" OS error code 46:level 3 halted "" OS error code 47: Level 3 Reset "" OS error Code 48:link number out of range ' "OS error code 49:protocol driver not attached" "OS error code 50:no CSI Struc Ture available "" OS error code 51:level 2 halted "OS error code 52:invalid exchange" OS error code 53:invalid r  Equest descriptor "" OS error code 54:exchange full "OS error code 55:no anode" "OS error code 56:invalid request Code "" OS error code 57:invalid slot "" OS error code 59:bad font file format "OS error code 60:device not a str EAM "" OS error code 61:NO data available "OS error code 62:timer expired" "OS error code 63:out of streams Resou  RCEs "" "" "" "" OS error code 64:machine is isn't on the network "" OS error code 65:package not installed "" OS error code 66:  Object is remote "" OS error code 67:link has been severed "OS error code 68:advertise error" OS error code 69:  Srmount error "" OS error code 70:communication error on send "OS error code 71:protocol error" OS error code 72: Multihop attempted "" OS Error code 73:rfs specific error ' OS error code 74:bad message ' OS error code 75:value too large for defined D ATA type "" "OS error code 76:name not unique on network" "OS error code 77:file descriptor in Bad state" "OS Error Co De 78:remote address changed "" OS error code 79:can not access a needed shared library "" OS Error code 80:accessi ng a corrupted shared library "" OS Error code Bay:. lib section on a.out corrupted "" OS error code 82:attempting to Li NK in too many shared libraries "" OS error code 83:cannot exec a shared library directly "" OS error code 84:invalid or incomplete multibyte or wide character "" OS error code 85:interrupted system call should is restarted "" OS error cod E 86:streams pipe Error "" OS error code 87:too many users "OS error code 88:socket operation on Non-socket" "Os Error code 89:destination address required "OS error code 90:message too long" "OS error code 91:protocol wrong Type for socket "" OS error code 92:protocol not available ' OS error code 93:PROTOCOL not supported ' OS error code 94:socket type not su  Pported "" "OS error code 95:operation not supported" "OS error code 96:protocol family not supported" "OS error code 97:address family not supported by protocol ' "OS error code 98:address already in use" "OS error code 99:cannot a  Ssign requested address "OS error code 100:network are down" "OS error code 101:network is unreachable" "OS error code 102:network dropped connection on reset "" OS error code 103:software caused connection abort "" OS error code 104:CO  Nnection Reset by peer "" OS error code 105:no buffer spaces available "" OS error code 106:transport endpoint is already Connected "" "OS error code 107:transport endpoint is not connected" "OS error code 108:cannot Send on Transport end Point shutdown "" OS error code 109:too many references:cannot splice "OS error code 110:connection timed out" Os er Ror Code 111:connectioN refused "" OS error code 112:host is down "OS error code 113:no route to Host" "OS error code 114:operation alread Y in progress "" OS error code 115:operation now progress "" OS error code 116:stale NFS file Handle "" OS error code  117:structure needs cleaning "" OS error code 118:not a xenix named type file "" OS error code 119:no XENIX semaphores Available "" OS error code 120:is a named type file "OS error code 121:remote I/O error" "OS error code 122:disk qu  Ota exceeded "" OS error code 123:no medium found "OS error code 124:wrong medium Type" "OS error code 125:operation  Canceled "" OS error code 126:required key not available "OS error code 127:key has expired" "OS error code 128:key  has been revoked "" OS error code 129:key is rejected by service "OS error code 130:owner died" "OS error code 131: State not recoverable "" MySQL error code 132:old database File "" MySQL error code 133:no record read before update "" My SQL Error code 134:recoRd. Already deleted (or record file crashed) "" MySQL error code 135:no more room in record file "" MySQL error code 136 : No more room in index file "" MySQL error code 137:no more records (read following end of file) "" MySQL Error code 138:unsu pported extension used for table "MySQL error code 139:too big row" MySQL error code 140:wrong create Options "" MySQL
Error code 141:duplicate unique key or constraint on write or update "MySQL error code 142:unknown character set used"  "MySQL error code 143:conflicting table definitions in sub-tables of the MERGE table" "MySQL error code 144:table is crashed  And last repair failed "" "MySQL error code 145:table is marked as crashed and should be repaired" "MySQL error code 146: Lock timed out;  Retry transaction "" MySQL Error code 147:lock table is full; Restart program with a larger locktable "" MySQL error code 148:updates are not allowed under a read only transactions "" M Ysql error code 149:lock deadlock; Retry transaction "" MySQL ErroR Code 150:foreign key constraint is incorrectly formed "MySQL error code 151:cannot add a child row" "MySQL error code 152:cannot Delete a parent row "
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.