在Linux中不管是启动桌面程序还是在控制台执行命令都会有一个返回值,可以叫做错误号(perror),在linux中执行命令后可通过命令:echo $?来查看上一条命令的返回值。要查看返回值的具体含义,可通过perror number查看。
Java中可通过 Runtime.getRuntime().exec(cmd) 执行命令,exec(prams)返回的是一个Process,可通过Process.waitFor()获取返回值
以下是Linux中返回值对照表
"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 such 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 unavailable"
"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 a 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 code 24: Too many open files"
"OS error code 25: Inappropriate ioctl for device"
"OS error code 26: Text file busy"
"OS error code 27: File too large"
"OS error code 28: No space 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 33: Numerical argument out of domain"
"OS error code 34: Numerical result out of range"
"OS error code 35: Resource deadlock avoided"
"OS error code 36: File name too long"
"OS error code 37: No locks available"
"OS error code 38: Function not implemented"
"OS error code 39: Directory not empty"
"OS error code 40: Too many levels of symbolic links"
"OS error code 42: No message of desired type"
"OS error code 43: Identifier removed"
"OS error code 44: Channel number out of range"
"OS error code 45: Level 2 not 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 structure available"
"OS error code 51: Level 2 halted"
"OS error code 52: Invalid exchange"
"OS error code 53: Invalid request 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 stream"
"OS error code 61: No data available"
"OS error code 62: Timer expired"
"OS error code 63: Out of streams resources"
"OS error code 64: Machine is not 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 data type"
"OS error code 76: Name not unique on network"
"OS error code 77: File descriptor in bad state"
"OS error code 78: Remote address changed"
"OS error code 79: Can not access a needed shared library"
"OS error code 80: Accessing a corrupted shared library"
"OS error code 81: .lib section in a.out corrupted"
"OS error code 82: Attempting to link 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 be restarted"
"OS error code 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 supported"
"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 assign requested address"
"OS error code 100: Network is 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: Connection reset by peer"
"OS error code 105: No buffer space 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 after transport endpoint shutdown"
"OS error code 109: Too many references: cannot splice"
"OS error code 110: Connection timed out"
"OS error code 111: Connection refused"
"OS error code 112: Host is down"
"OS error code 113: No route to host"
"OS error code 114: Operation already in progress"
"OS error code 115: Operation now in 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 quota 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 was 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"
"MySQL error code 134: Record was 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 after end of file)"
"MySQL error code 138: Unsupported 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 MERGE table"
"MySQL error code 144: Table is crashed and last repair failed"
"MySQL error code 145: Table was 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"
"MySQL 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"
分享到:
相关推荐
linux命令执行后无论成功与否都有一个返回值: 如果为 0,则表示命令执行成功,其它值则表示错误, 具体的错误码含义如下: OS error code 1: Operation not permitted OS error code 2: No such file or ...
文档中列出linux报错后的返回值以及内容,翻译是自己翻译的,如有差异请联系改正.
和之前C++执行Linux Bash命令的方法 一样,Python依然支持system调用和popen()函数来执行linux bash命令。 方法一:system调用 #仅仅在一个子终端运行系统命令,而不能获取命令执行后的返回信息 import os os....
“wc”是一个linux实用命令,用来显示一个文件里的字符数、单词数和行数。如果没有指定文件,那么就统计从标准输入设备上输入的内容;如果指定了多个文件,它将依次显示各文件名及相应的统计结果。在这一题里,我们...
下面的代码用于在c++函数里面调用shell,并且执行命令,取回命令执行结果。 #include #include #include #include int main() { const int SIZE = 64; const int MAX_RESPONSE_SIZE = 65535; char charBuff[SIZE...
2、参数返回,可以显示加:return 返回,如果不加,将以最后一条命令运行结果,作为返回值。 return后跟数值n(0-255 实例(testfun1.sh): #!/bin/sh fSum 3 2; function fSum() { echo $1,$2; return $(($1...
这个文档是关于内核2.6.18-194.el5的提权,利用的是nc命令
1.在shell脚本执行python脚本时,需要通过python脚本的返回值来判断后面程序要执行的命令 例:有两个py程序 hello.py 代码如下: def main(): print “Hello” if __name__==’__main__’: main() world.py def ...
简单易懂哦!显示文件长格式信息 void printlong(char *name) { struct stat buf; struct passwd *usr; struct group *grp; int rt;... struct tm *ttime;... //调用lstat 获取文件属性,并对返回值做错
Linux—curl 命令用法大总结 1、基本用法 2、保存访问的网页 3、测试网页返回值 4、指定proxy服务器以及其端口 5、cookie 6、模仿浏览器 7、伪造referer(盗链) 8、***下载文件 9、断点续传 10、***上传文件 11、...
5.2.4 过程返回值 5.3 脚本执行命令 5.3.1 exit 命令 5.3.2 trap命令 5.3.3 if 命令 5.3.4 case 命令 5.3.5 for 语句 5.3.6 while命令 5.3.7 until命令 5.3.8 break 命令 5.3.9 continue 命令 5 .4 控制shell 5.4.1 ...
——上一个命令的状态返回值$#——传递给脚本参数的个数$*或$@——引用传递给脚本的所有参数$1+shift(轮替):可引用所有参数,每次shift可以轮替下一
3.2.1 使用at命令提交命令或脚本 26 3.2.2 列出所提交的作业 27 3.2.3 清除一个作业 27 3.3 &命令 27 3.3.1 向后台提交命令 28 3.3.2 用ps命令查看进程 28 3.3.3 杀死后台进程 28 3.4 nohup命令 29 3.4.1 使用nohup...
最近工作接触到了一些Linux上面的文本处理,数据量还是蛮大的,不可避免的学期了shell,awk等脚本语言。下面这篇文章主要给大家介绍了关于Shell中关于处理方法返回值问题的相关资料,需要的朋友可以参考借鉴,下面来...
1.使用Ping命令测试系统类型。 2..linux系统SSH暴力破解。 3.Ping命令返回值讲解及修改。 4.字典生成器讲解。 5.系统防范
(1)熟悉 linux 常用命令:pwd,useradd,passwd, who, ps, pstree, kill, top, ls, cd, mkdir, rmdir, cp, rm, mv, cat, more, grep 等。 (2) 实现一个模拟的 shell: 编写三个不同的程序 cmd1.c,cmd2.c,cmd3.c,...
linux shell 可以用户定义函数,然后在shell脚本中可以随便... 2、参数返回,可以显示加:return 返回,如果不加,将以最后一条命令运行结果,作为返回值。 return后跟数值n(0-255 实例(testfun1.sh): #!/bin/sh f
Linux编程时候,如果我们需要调用shell命令或脚本通常使用system方法。如system(“ls”) 该方法返回值为0或-1,即成功或失败。而有的时候我们想要获取shell命令执行的结果,该怎么办呢? 我们可以将shell...