Linux grep return code
The exit code is 1 because nothing was matched by grep.
EXIT STATUS The exit status is 0 if selected lines are found, and 1 if not found. If an error occurred the exit status is 2. (Note: POSIX error handling code should check for '2' or greater.)
The output is zero because the count of 'Total' is zero. This due to the -c option:
-c, --count Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option (see below), count non-matching lines. (-c is specified by POSIX.)
If you would like to force an exit code of 0, you can just append || true to your command:
echo 'Total' | grep -c No || true
Linux grep return code的更多相关文章
- Hive的Shell里hive> 执行操作时,出现FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask错误的解决办法(图文详解)
不多说,直接上干货! 这个问题,得非 你的hive和hbase是不是同样都是CDH版本,还是一个是apache版本,一个是CDH版本. 问题详情 [kfk@bigdata-pro01 apache-h ...
- go构建脚本ansible分发时出现的问题总结“non-zero return code”
背景介绍: 在Jenkins服务器配置go项目发布脚本,编译完成后,使用ansible分发到部署服务器上,然后将启动项目脚本start_coachcore.sh发布到目标服务器上,执行启动,目标服务器 ...
- linux grep命令
linux grep命令1.作用Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来.grep全称是Global Regular Expressio ...
- Description Resource Path Location Type Error executing aapt: Return code -1073741819 Client line 1
Logcat报错:Description Resource Path Location Type Error executing aapt: Return code -1073741 ...
- Hive创建表格报【Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException】引发的血案
在成功启动Hive之后感慨这次终于没有出现Bug了,满怀信心地打了长长的创建表格的命令,结果现实再一次给了我一棒,报了以下的错误Error, return code 1 from org.apache ...
- NMAKE:fatal error U1077.“\..\.cl.exe” return code 0xc0000135
NMAKE:fatal error U1077.“cl.exe” return code 0xc0000135 产生原因:在安装visual studio的时候没有勾选注册环境变量导致的. 解决办法: ...
- Oracle Error - "OCIEnvCreate failed with return code -1 but error message text was not available".
ISSUE: When trying to connect to an Oracle database you receive the following error: "OCIEnvCre ...
- maven自建仓库 Return code : 405
maven自建仓库jar包上传: jar包上传可以采用在自建仓库上系统上传以及通过配置maven setting.xml以及pom.xml上传. maven通过配置上传需要用户名密码以及maven仓库 ...
- Maven-008-Nexus 私服部署发布报错 Failed to deploy artifacts: Failed to transfer file: ... Return code is: 4XX, ReasonPhrase: ... 解决方案
我在部署构件至 maven nexus 私服时,有时会出现 Failed to deploy artifacts: Failed to transfer file: ... Return code i ...
随机推荐
- JS window对象 Navigator对象 Navigator 对象包含有关浏览器的信息,通常用于检测浏览器与操作系统的版本。
Navigator对象 Navigator 对象包含有关浏览器的信息,通常用于检测浏览器与操作系统的版本. 对象属性: 查看浏览器的名称和版本,代码如下: <script type=" ...
- batch normlization (BN)的讲解
1. https://zhuanlan.zhihu.com/p/54073204(简单理解) 2. https://zhuanlan.zhihu.com/p/34879333 (有举例说明,但是不太理 ...
- dill:解决python的“AttributeError: Can't pickle local object”及无法pickle lambda函数的问题
python的pickle是用来序列化对象很方便的工具,但是pickle对传入对象的要求是不能是内部类,也不能是lambda函数. 比如尝试pickle这个内部类: 结果会报错AttributeErr ...
- logging自定义模板
import logging logger=logging.getLogger('这是一个日志')#先生成一个日志 formatter=logging.Formatter('%(asctime)s % ...
- AngularJS 项目开发实战
目录 啰嗦一下 你问我答 目录结构 压缩 其他 啰嗦一下 最近在开发一个项目时,调研了一下AngularJS,发现这个框架功能很丰富,而且用起来也很方便,所以深入了解了一下,在此分享一下我的感悟. A ...
- 循环神经网络(Recurrent Neural Network)
传统的神经网络模型,隐藏层的节点之间是无连接的,如下图所示. 而循环神经网络隐藏层的节点之间有连接,主要用于对序列数据进行分类.预测等处理.有连接意味着需要接受信息,这种网络通常用来对序列数据进行处理 ...
- vue 表单输入绑定 checkbox
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Table边框合并
<style> table, table tr th, table tr td { border: 1px solid #0094ff; } table { width: 200px; m ...
- bootstrap相关使用
如果想做成响应式效果,使用栅格系统产生 小于768手机端 : col-xs- 大于768小于992平板 : col-sm- 大于992小于1200 : col-md- 大于1200 : col-lg- ...
- Unity NGUI插件
前言:关于Unity中关于UI的插件,我们最开始学的是UGUI,是Unity自带的UI系统,而在Unity版本还没更新出UGUI之前,除了NGUI没有一个更好些的插件,所以人们不得不去选择NGUI去制 ...