为什么有 HIT 时 grep returns 是非零值?
Why does grep returns a non-zero value when there is a HIT?
为什么有 HIT 时 grep returns 是一个非零值?
非零值不是应该用于不成功的命令执行吗?
这是您可以在 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.
因此,根据您输入的命令,您的问题有多种答案。如果您需要更多帮助,请使用完整的命令/过程编辑您的 post。
为什么有 HIT 时 grep returns 是一个非零值?
非零值不是应该用于不成功的命令执行吗?
这是您可以在 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.
因此,根据您输入的命令,您的问题有多种答案。如果您需要更多帮助,请使用完整的命令/过程编辑您的 post。