当前位置:网站首页>shell [stdin/stdout/stderr][重定向]
shell [stdin/stdout/stderr][重定向]
2022-08-11 01:44:00 【SEVENTHD7】
1、文件描述符
Linux系统预留可三个文件描述符:0、1和2,他们的意义如下所示:
0——标准输入(stdin)
1——标准输出(stdout,也就是屏幕)
2——标准错误(stderr)
2、重定向
- 2>&1
这条命令用到了重定向绑定,采用&可以将两个输出绑定在一起。
./a.out 1>log.txt 2>error.txt
>/dev/null 2>&1 和 2>&1 >/dev/null
>/dev/null 2>&1
相当于 1>/dev/null 2>&1
2>&1 >/dev/null
相当于 2>&1 1> /dev/null错误信息输出到屏幕,标准输出到"黑洞"
命令 标准输出 错误输出 >/dev/null 2>&1 丢弃 丢弃 2>&1 >/dev/null 丢弃 屏幕
边栏推荐
- FPGA learning column (xinlinx) serial communication -
- 络达开发---自定义Timer的实现
- 划分字母区间[贪心->空间换时间->数组hash优化]
- How to convert url to obj or obj to url
- 络达开发---串口日志&日志过滤
- 本周四晚19:00知识赋能第六期第5课丨OpenHarmony WiFi子系统
- 络达开发---UI定义+自定义按钮事件
- 进程间通信方式(2)有名管道
- Sigma development pays attention to details
- Is container technology really the savior of environmental management?
猜你喜欢
apache+PHP+MySQL+word press, page error when installing word press?
MySQL Basics [Part 1] | Database Overview and Data Preparation, Common Commands, Viewing Table Structure Steps
颠覆性创新招商,链动2+1是个怎么样的制度模式?
【iframe父页面调用子页面的方法】踩坑:获取元素的时候需要用 `[x]`是关键,不能用`.eq(x)`否则获取不到。
This Thursday evening at 19:00, Lesson 5 of the sixth phase of knowledge empowerment丨OpenHarmony WiFi subsystem
数据库数据采集利器FlinkCDC
惨遭面试官吊打高并发系统设计,回来学习 2400 小时后成功复仇
22-7-31
88Q2110 通过C22方式访问C45 phy地址
Qt 中的隐式共享
随机推荐
MySQL进阶查询
联盛德W801系列5-微信小程序与W801蓝牙通信例程(阅读笔记)
数据的存储(下)——浮点型在内存中的存储
软件测试面试题:什么是数据的对立性,有几个层次?
测试3年,开口就要25k?面试完最多给15k...
生信实验记录(part3)--scipy.spatial.distance_matrix
MySQL indexes and transactions
络达开发---自定义BLE服务(二):功能实现
【Video】Report Sharing | 2021 Insurance Industry Digital Insights
vim simple save window id
std::format格式化自定义类型
络达开发---自定义Timer的实现
22-7-31
This Thursday evening at 19:00, Lesson 5 of the sixth phase of knowledge empowerment丨OpenHarmony WiFi subsystem
The iterator and generator
MySQL八股文背诵版(续)
软件测试面试题:I P协议、RARP协议、ICMP协议与ARP协议的功能是什么?
基于 HPSO 与多核 LSSVM 的网络入侵检测
How to realize the repeatable design of FPGA
Vim take on a window.