我使用过的Linux命令之perror - 解释错误代码

我使用过的Linux命令之perror - 解释错误代码

本文链接:http://codingstandards.iteye.com/blog/1127327   (转载请注明出处)

 

用途说明

perror命令是MySQL数据库系统中的一个工具程序,它用于打印C语言中errno错误代码的含义、也可以打印MySQL中存储引擎错误代码的含义。(perror prints a description for a system error code or for a storage engine (table handler) error code.)

 

由于perror是MySQL中的一个工具程序,在没有安装MySQL的机器上就无法执行,本文的示例四将给出大致的源代码供大家参考。

 

常用参数

格式:perror <errno>

打印系统错误代码errno值的含义。

 

格式:perror <Errcode>

打印MySQL数据库系统中定义的错误代码的含义。

 

格式:perror <err1> <err2> ...

打印多个错误代码的含义。

 

man perror 写道
For most system errors, MySQL displays, in addition to an internal text message, the system error code in one
of the following styles:

message ... (errno: #)
message ... (Errcode: #)
 

Linux操作系统中定义的errno值如下所示。

errno.h 写道
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child processes */
#define EAGAIN 11 /* Try again */
#define ENOMEM 12 /* Out of memory */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Device or resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math argument out of domain of func */
#define ERANGE 34 /* Math result not representable */
#define EDEADLK 35 /* Resource deadlock would occur */
#define ENAMETOOLONG 36 /* File name too long */
#define ENOLCK 37 /* No record locks available */
#define ENOSYS 38 /* Function not implemented */
#define ENOTEMPTY 39 /* Directory not empty */
#define ELOOP 40 /* Too many symbolic links encountered */
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define ENOMSG 42 /* No message of desired type */
#define EIDRM 43 /* Identifier removed */
#define ECHRNG 44 /* Channel number out of range */
#define EL2NSYNC 45 /* Level 2 not synchronized */
#define EL3HLT 46 /* Level 3 halted */
#define EL3RST 47 /* Level 3 reset */
#define ELNRNG 48 /* Link number out of range */
#define EUNATCH 49 /* Protocol driver not attached */
#define ENOCSI 50 /* No CSI structure available */
#define EL2HLT 51 /* Level 2 halted */
#define EBADE 52 /* Invalid exchange */
#define EBADR 53 /* Invalid request descriptor */
#define EXFULL 54 /* Exchange full */
#define ENOANO 55 /* No anode */
#define EBADRQC 56 /* Invalid request code */
#define EBADSLT 57 /* Invalid slot */
#define EDEADLOCK EDEADLK
#define EBFONT 59 /* Bad font file format */
#define ENOSTR 60 /* Device not a stream */
#define ENODATA 61 /* No data available */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* Object is remote */
#define ENOLINK 67 /* Link has been severed */
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#define EPROTO 71 /* Protocol error */
#define EMULTIHOP 72 /* Multihop attempted */
#define EDOTDOT 73 /* RFS specific error */
#define EBADMSG 74 /* Not a data message */
#define EOVERFLOW 75 /* Value too large for defined data type */
#define ENOTUNIQ 76 /* Name not unique on network */
#define EBADFD 77 /* File descriptor in bad state */
#define EREMCHG 78 /* Remote address changed */
#define ELIBACC 79 /* Can not access a needed shared library */
#define ELIBBAD 80 /* Accessing a corrupted shared library */
#define ELIBSCN 81 /* .lib section in a.out corrupted */
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
#define ELIBEXEC 83 /* Cannot exec a shared library directly */
#define EILSEQ 84 /* Illegal byte sequence */
#define ERESTART 85 /* Interrupted system call should be restarted */
#define ESTRPIPE 86 /* Streams pipe error */
#define EUSERS 87 /* Too many users */
#define ENOTSOCK 88 /* Socket operation on non-socket */
#define EDESTADDRREQ 89 /* Destination address required */
#define EMSGSIZE 90 /* Message too long */
#define EPROTOTYPE 91 /* Protocol wrong type for socket */
#define ENOPROTOOPT 92 /* Protocol not available */
#define EPROTONOSUPPORT 93 /* Protocol not supported */
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT 96 /* Protocol family not supported */
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
#define EADDRINUSE 98 /* Address already in use */
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
#define ENETDOWN 100 /* Network is down */
#define ENETUNREACH 101 /* Network is unreachable */
#define ENETRESET 102 /* Network dropped connection because of reset */
#define ECONNABORTED 103 /* Software caused connection abort */
#define ECONNRESET 104 /* Connection reset by peer */
#define ENOBUFS 105 /* No buffer space available */
#define EISCONN 106 /* Transport endpoint is already connected */
#define ENOTCONN 107 /* Transport endpoint is not connected */
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS 109 /* Too many references: cannot splice */
#define ETIMEDOUT 110 /* Connection timed out */
#define ECONNREFUSED 111 /* Connection refused */
#define EHOSTDOWN 112 /* Host is down */
#define EHOSTUNREACH 113 /* No route to host */
#define EALREADY 114 /* Operation already in progress */
#define EINPROGRESS 115 /* Operation now in progress */
#define ESTALE 116 /* Stale NFS file handle */
#define EUCLEAN 117 /* Structure needs cleaning */
#define ENOTNAM 118 /* Not a XENIX named type file */
#define ENAVAIL 119 /* No XENIX semaphores available */
#define EISNAM 120 /* Is a named type file */
#define EREMOTEIO 121 /* Remote I/O error */
#define EDQUOT 122 /* Quota exceeded */
#define ENOMEDIUM 123 /* No medium found */
#define EMEDIUMTYPE 124 /* Wrong medium type */
 

 

 

使用示例

示例一 打印错误代码的含义

[root@jfht ~]# perror 1
OS error code   1:  Operation not permitted

#define EPERM 1 /* Operation not permitted */
[root@jfht ~]# perror 13 64
OS error code  13:  Permission denied
OS error code  64:  Machine is not on the network

#define EACCES 13 /* Permission denied */

#define ENONET 64 /* Machine is not on the network */
[root@jfht ~]#

补充一个:既是操作系统errno,也是MySQL错误代码的。

[root@jfht ~]# perror 121
OS error code 121:  Remote I/O error
MySQL error code 121: Duplicate key on write or update

 

示例二 打印不存在的错误代码的含义

要注意的是,perror似乎并不能打印SQL执行时所报的错误代码的含义。

mysql> select;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
 for the right syntax to use near '' at line 1、

 

[root@jfht ~]# perror 42000
Illegal error code: 42000
[root@jfht ~]# perror 1064
Illegal error code: 1064
[root@jfht ~]#

 

示例三 枚举所有错误代码

[root@jfht ~]# for i in $(seq 1 10000); do perror $i; done >10000.txt 2>/dev/null
[root@jfht ~]# cat 10000.txt
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
MySQL error code 120: Didn't find key on read or update
OS error code 121:  Remote I/O error
MySQL error code 121: Duplicate key on write or update
OS error code 122:  Disk quota exceeded
MySQL error code 122: Internal (unspecified) error in handler
OS error code 123:  No medium found
MySQL error code 123: Someone has changed the row since it was read (while the table was locked to prevent it)
OS error code 124:  Wrong medium type
MySQL error code 124: Wrong index given to function
OS error code 125:  Operation canceled
MySQL error code 125: Undefined handler error 125
OS error code 126:  Required key not available
MySQL error code 126: Index file is crashed
OS error code 127:  Key has expired
MySQL error code 127: Record file is crashed
OS error code 128:  Key has been revoked
MySQL error code 128: Out of memory in engine
OS error code 129:  Key was rejected by service
MySQL error code 129: Undefined handler error 129
OS error code 130:  Owner died
MySQL error code 130: Incorrect file format
OS error code 131:  State not recoverable
MySQL error code 131: Command not supported by database
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 in table
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
MySQL error code 153: No savepoint with that name
MySQL error code 154: Non unique key block size
MySQL error code 155: The table does not exist in engine
MySQL error code 156: The table already existed in storage engine
MySQL error code 157: Could not connect to storage engine
MySQL error code 158: Unexpected null pointer found when using spatial index
MySQL error code 159: The table changed in storage engine
MySQL error code 160: There's no partition in table for the given value
MySQL error code 161: Row-based binlogging of row failed
MySQL error code 162: Index needed in foreign key constraint
MySQL error code 163: Upholding foreign key constraints would lead to a duplicate key error in some other table
MySQL error code 164: Table needs to be upgraded before it can be used
MySQL error code 165: Table is read only
MySQL error code 166: Failed to get next auto increment value
MySQL error code 167: Failed to set row auto increment value
MySQL error code 168: Unknown (generic) error from engine
MySQL error code 169: Record is the same
MySQL error code 170: It is not possible to log this statement
MySQL error code 171: The event was corrupt, leading to illegal data being read
MySQL error code 172: The table is of a new format not supported by this version
MySQL error code 173: The event could not be processed no other hanlder error happened
MySQL error code 174: Got a fatal error during initialzaction of handler
MySQL error code 175: File to short; Expected more data in file
MySQL error code 176: Read page with wrong checksum
MySQL error code 177: Too many active concurrent transactions
[root@jfht ~]#

 

示例四 perror大体的C语言代码

[root@centos55 ~]# perror
-bash: perror: command not found
[root@centos55 ~]#

[root@centos55 ~]# cat >perror.c
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char* argv[])
{
        if (argc == 1)
        {
                fprintf(stderr, "usage: %s <errno> [<errno> ...]\n", argv[0]);
                exit(1);
        }
        else
        {
                int i;
                for (i = 1; i < argc; ++i)
                {
                        int ec = strtoul(argv[i], 0, 0);
                        fprintf(stdout, "OS error code %d: %s\n", ec, strerror(ec));
                }
                exit(0);
        }
}


[root@centos55 ~]# gcc -Wall -o /usr/bin/perror perror.c
[root@centos55 ~]# perror 1                             
OS error code 1: Operation not permitted
[root@centos55 ~]#

注:该源代码无法对非法的错误代码进行判断。perror程序在提供的错误代码非法时会在标准错误设备上输出信息,而不是标准输出设备。

 

问题思考

相关资料

【1】MySQL中文手册  perror — Explain Error Codes

http://dev.mysql.com/doc/refman/5.0/en/perror.html

 

 

返回 我使用过的Linux命令系列总目录

 

对于Linux中errno使用的问题  最近在网络编程使用的过程中,发现errno会经常使用。因此决定在此做个留用,以备以后使用。。。 虽然errno是非线程安全的,但是可以通过几种机制保证其安全。。 最近在使用的过程中获得了errno,程序无法执行,也不知道如何解决问题。因此,理解每一个返回的errno整数值的含义是很重要的。。这个我们可以通过strerror函数来实现。。 strerror(返回整数errno对 阅读详情

相关推荐

如何在TRAE(国际版)中搭建ESP-IDF环境以及怎么使用ESP-IDF插件编译烧录到ESP32s3中

点击进入,再点击ESPRESSIF中的EXPRESS,这里会下载ESP-IDF所需要的全部工具和包等等。首先我们从终端中进入项目所在的目录中,我的项目在E盘下的jikecode\esp32s3-client中,我就进入这个目录下。,因为我的项目是针对ESP32-S3进行开发的,所以这里的芯片型号是esp32s3,大家根据各自芯片的型号来输入。执行了这个命令后,ESP-IDF会自动配置与ESP-S3相关的编译选项,生成对应芯片的配置文件。进入第一个ESP-IDF插件,进行安装,注意安装的是。

一个爱折腾技术的普通人,分享踩过的坑、学到的干货。 1502

linux中errorno

errorno在linux中是一个整型左值,当UNIX函数出错时,其被赋予一个整型常量,这些常量均以E开头。 关于errno的两个规则与两个函数 1.两个规则:①,如果没有出错,则其值不会被一个例程清除,仅当函数的返回值指明出错时,才检验其值。 ②,任一函数不会将errno的值设置为0. 2.两个函数:①#include char *strerror(int errnum); ②#i

xiaocaichonga的专栏 6676

基于ROS2系统开发机器人

以上是基于ROS 2开发机器人的基本流程和一个简单的发布者-订阅者示例。通过这个流程,你可以逐步扩展和优化你的机器人系统,实现更复杂的功能。

xuweilin的博客 1494

Linux学习笔记【函数】——perror

C 库函数 void perror(const char *str) 把一个描述性错误消息输出到标准错误 stderr。首先输出字符串 str,后跟一个冒号,然后是一个空格。

qq_54132908的博客 842

论文分享|ECCV2022,PATnet,Cross-Domain Few-Shot Semantic Segmentation,CDFSS新基准,文末有复现教程

这篇论文提出的跨域小样本语义分割(CD-FSS)任务,旨在将源域学习的分割能力迁移到目标域,仅需少量标注样本。针对传统小样本分割方法在跨域场景性能下降的问题,作者提出了基于金字塔锚点变换的网络(PATNet),通过将域相关特征转换为域无关特征,并引入任务自适应微调推理(TFI)提升目标域适应能力。实验表明,PATNet在1-shot和5-shot设置下分别比现有方法提升8.49%和10.61%的准确率。同时,作者构建了CD-FSS基准并设计了任务难度评估指标。代码和数据集已开源,复现难度中等。

m0_74277350的博客 1094

磁盘I/O %util特别高

磁盘I/O %util特别高

eagle89的专栏 3088

学习的笔记

1. linux中perror和printf的区别 perror是用来打印系统错误信息的,参数只能是字符串 printf是用来打印用户指定的信息的,参数比较多样化,可以通过strerror(errno)实现perror的功能 ps: errno是个整型,系统错误码,strerror是将其转为字符串的函数 perror直接输出到屏幕,不进缓冲区 prinft会先进入缓冲区,加’\n’可以保证立即输出 参考文章:【1】 【2】

lwq18851402663的博客 1150

生存网络与mlr3proba

通过结合生存网络和mlr3proba,可以使用生存网络模型来预测个体在给定时间点发生事件的概率,并使用mlr3proba提供的工具进行模型的训练、评估和选择最佳模型。iii)基本的机器学习(ML)方法,如重新排序和调整。在本文中,我们将只讨论前五种,因为它们在文献中得到了更好的建立,并且它们具有相同的接口,这简化了调优,我们将在下面看到。我们不会为模型指定自定义架构,而是使用默认架构,如果你熟悉PyTorch,那么你可以选择创建自己的架构,如果你愿意的话,通过将其传递给模型中的custom_net参数。

weixin_46587777的博客 1363

linux错误码中文解释,Linux命令之perror - 解释错误代码

用途说明:perror命令是MySQL数据库系统中的一个工具程序,它用于打印C语言中errno错误代码的含义、也可以打印MySQL中存储引擎错误代码的含义。(perrorprints a description for a system error code or for a storageengine (table handler) error code.)由于perror是MySQL中的一个工...

weixin_34269309的博客 1680

MinerU PDF解析工具:从安装配置到本地部署与API调用的全流程指南

MinerU是由上海人工智能实验室开源的高质量PDF解析工具,可将包含图片、公式、表格的复杂PDF转换为Markdown和JSON格式。安装前需准备Python 3.10-3.13环境,推荐使用8核CPU和32GB内存。支持通过HuggingFace或ModelScope下载模型,国内用户建议使用ModelScope源加速下载。配置文件中可设置本地模型路径,支持多种语言识别和两种解析后端(Pipeline和VLM)。输出包含可视化文件、内容文件和中间结果文件,并提供了完整的Python API调用示例。

算法工程师 2026

开尔文四线法与电桥(uΩ电阻检测)

本文介绍了开尔文四线法与电桥在电阻测量中的应用,特别是针对uΩ级别电阻的精确检测。讨论了基本电桥电路的工作原理,强调了开尔文四线法的优势,它能消除导线和接触电阻的影响。文中还提到了测试设备的介绍,包括不同级别的电阻测试,并详细阐述了uΩ级别电阻测试的步骤和注意事项。此外,对比了惠斯通电桥与开尔文电桥,强调了它们在电阻测量中的作用和计算方法。

让你爱上电路设计 7858

linux os errorNo 的解释

foxox 1170

46、聚类算法在智能交通数据分析中的应用

本文探讨了聚类算法在智能交通数据分析中的应用,介绍了K-均值算法、K-中心点算法和基于模型的聚类算法的基本原理及特点,并结合实际交通数据讨论了其应用场景与挑战。通过聚类分析,能够从海量交通数据中发现隐藏模式,为交通管理和规划提供科学依据。文章还展示了具体的案例分析和实现流程,为未来智能交通系统的发展提供了参考。

zz67890的博客 133

编写命令行工具必备知识—Linux终端执行命令后的返回值

Linux终端中执行一条命令后会返回一个状态值(Error Number),返回0说明程序执行成功,返回非0说明程序执行出错,返回非0的情况下,一般都会输出错误原因。讲到这里会有同学疑惑了,怎么我执行命令的时候没有看到返回值呢?其实这个不能怪你没看到,因为默认是不显示返回值的。一条命令执行完成后,返回值保存在特殊变量 $?中,可以使用 echo $?每次都使用 echo $?macOS系统中也类似,只是macOS系统默认没有perror命令。

路多辛的所思所想 1072

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

linux命令解释代码,小弟我使用过的Linux命令之perror - 解释异常代码

我使用过的Linux命令之perror - 解释错误代码我使用过的Linux命令之perror - 解释错误代码本文链接:http://codingstandards.iteye.com/blog/1127327(转载请注明出处)用途说明perror命令是MySQL数据库系统中的一个工具程序,它用于打印C语言中errno错误代码的含义、也可以打印MySQL中存储引擎错误代码的含义。(perror ...

weixin_30571837的博客 645

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

mysql perror,perror的使用

我使用过的Linux命令之perror -解释错误代码用途说明perror命令是MySQL数据库系统中的一个工具程序,它用于打印C语言中errno错误代码的含义、也可以打印MySQL中存储引擎错误代码的含义。(perror prints adescription for a system error code or for a storage engine (table handler)error...

weixin_36039434的博客 745

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

一天一条Linux指令-perror

用途说明 perror命令是MySQL数据库系统中的一个工具程序,它用于打印C语言中errno错误代码的含义、也可以打印MySQL中存储引擎错误代码的含义。(perror prints a description for a system error code or for a storage engine (table handler) error code.)   由于per

u012313689的博客 1137

Linux命令学习:perror

用途说明 perror命令是MySQL数据库系统中的一个工具程序,它用于打印C语言中errno错误代码的含义、也可以打印MySQL中存储引擎错误代码的含义。(perror prints a description for a system error code or for a storage engine (table handler) error code.)   由于per

无香花自开 3359

linux perror()函数

头文件:         #include perror是包含在这个文件里; 函数定义:   void perror(const char *s);  函数说明   perror ( )用 来 将 上 一 个 函 数 发生 错 误 的 原 因 输 出 到 标 准 设备 (stderr) 。参数 s 所指的字符串会先打印出,后面再加上出错原因字符串。此错误原因依照全局变量err

lianliange85的专栏 4403

Linux gdb 调试,perror 解惑

gdb 调试简记,perror 解惑

weixin_43391310的博客 243

linux下perror函数,Linux/Unix C编程之的perror函数,strerror函数,errno

#include // voidperror(const char *msg);#include // char*strerror(int errnum);#include //errnoerrno是错误代码,在errno.h头文件中void perror(const char *s)perror是错误输出函数,在标准输出设备上输出一个错误信息。参数s一般是参数错误的函数例如perror("...

weixin_42514222的博客 1016

linux下错误的捕获:errno和strerror的使用,以及perror和strerror的区别

原文链接:https://www.cnblogs.com/Cccarl/p/6752610.html 经常在调用linux 系统api 的时候会出现一些错误,比方说使用open() write() creat()之类的函数有些时候会返回-1,也就是调用失败,这个时候往往需要知道失败的原因。这个时候使用errno这个全局变量就相当有用了。 在程序代码中包含 #include <errno.h&...

weixin_41666796的博客 518

linux c 之perror和exit使用

一、perror介绍 perror函数用一种简单统一的方式报告错误。例如,一个程序试读一个不存在的磁盘文件,操作系统除了“出错了!”,这时,库函数首先会将代表操作出错的具体原因的错误代码保存到全局整型变量errono(在errno.h中定义),然后它再将错误提示传给用户程序。perror函数只是将errno代表的特定的错误报告给用户,它的原型在stdio.h中定义下: void perror( c...

qq_35429629的博客 746
上一篇: 我使用过的Linux命令之ping - 测试与目标主机的连通性
下一篇: 我使用过的Linux命令之mkdir - 创建目录
codingstandards
博客等级 码龄16年 12粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值