centos 为什么存在HIT时grep返回非零值?

ulmd4ohb  于 2022-11-08  发布在  其他
关注(0)|答案(1)|浏览(219)

为什么存在HIT时grep返回非零值?
非零值不是应该表示不成功的命令执行吗?

0md85ypi

0md85ypi1#

以下是您在man page of the grep command中可以找到的内容:

Exit Status grep exits with one of the following values:
0 One or more lines were selected.
1 No lines were selected.
>1 An error occurred - syntax error in pattern, inaccessible input files, or other system error. In other words a failure to find a matching item is reported as an error (1)

The '-v' option can be used to effectively invert the exit status.

因此,根据您输入的命令,您的问题会有几个答案。如果您需要更多帮助,请使用完整的命令/过程编辑您的帖子。

相关问题