Advanced redirection features
here are three types of I/O, which each have their own identifier, called a file descriptor:
standard input: 0
standard output: 1
standard error: 2
In the following descriptions, if the file descriptor number is omitted, and the first character of the redirection operator is <, the redirection refers to the standard input (file descriptor 0). If the first character
of the redirection operator is >, the redirection refers to the standard output (file descriptor 1).
Some practical examples will make this more clear:
ls > dirlist 2>&1
will direct both standard output and standard error to the file dirlist, while the command
ls 2>&1 > dirlist
will only direct standard output to dirlist. This can be a useful option for programmers.
Things are getting quite complicated here, don't confuse the use of the ampersand here with the use of it inSection
4.1.2.1, where the ampersand is used to run a process in the background. Here, it merely serves as an indication that the number that follows is not a file name, but rather a location that the data stream is pointed to. Also note that the bigger-than sign
should not be separated by spaces from the number of the file descriptor. If it would be separated, we would be pointing the output to a file again. The example below demonstrates this:
[nancy@asus /var/tmp]$ ls 2> tmp [nancy@asus /var/tmp]$ ls -l tmp |
The first command that nancy executes is correct (eventhough no errors are generated and thus the file to which standard error is redirected is empty). The second command expects that 2 is
a file name, which does not exist in this case, so an error is displayed.
All these features are explained in detail in the Bash Info pages.
Advanced redirection features的更多相关文章
- Enhancing the Application: Advanced JDBC Features(转)
Enhancing the Application: Advanced JDBC Features This chapter describes additional functionality th ...
- Spring Security(二十一):6.3 Advanced Web Features
6.3.1 Remember-Me Authentication (记住我的身份验证) See the separate Remember-Me chapter for information on ...
- # advanced packaging
目录 advanced packaging ASM NEXX ASMPT完成收購NEXX 準備就緒迎接先進半導體封裝之高速增長 Intro Bumping 产品供应 晶圆溅镀– Apollo 300 ...
- 2.Kali安装VMware tools(详细+异常处理)
dnt@MT:~$ cd /media/cdrom0 进入光驱内 dnt@MT:/media/cdrom0$ ls 查看当前目录下有哪些内容manifest.txt run_upgrader.sh V ...
- 【转】虚拟机VMware与主机共享文件介绍
from: http://www.cnblogs.com/kerrycode/p/3818095.html 写的比较详细,但是vm版本较旧. 2:通过共享文件夹功能 虚拟机VMware提供了在宿主机与 ...
- Deployment options
Play applications can be deployed virtually anywhere: inside Servlet containers, as standalone serve ...
- 分享15个优秀的 CSS 解决方案和工具
CSS 代码是很难管理,尤其是在大型项目. 样式都写在一个全局作用域里,通过复杂的选择器来指向特定的页面元素.冗余.膨胀和维护可以成为前端开发人员的一场噩梦.幸运的是我们有一些 CSS 工具来帮助开发 ...
- Oracle Linux 5.7安装VMware Tools的问题
案例环境介绍: 虚拟机的版本:VMware® Workstation 8.0.3 build-703057 操作系统版本:Oracle Linux Server release 5.7 ...
- 虚拟机VMware与主机共享文件介绍
我们经常会在Windows平台安装虚拟机VMware,不管是出于实验测试还是工作需要,伴随而来的就是经常需要在Windows系统和虚拟机系统之间进行共享数据文件,例如,需要将Window主机上的Ora ...
随机推荐
- css伪元素 ::after ::before
我遇到的问题: div盒子标签设置了伪元素 ::after ::before 并给这俩content内容设置了空属性,添加了背景图,发现这两个伪元素没有宽度和高度. 解决方法 给设置伪元素的盒子的 ...
- 【高速接口-RapidIO】4、Xilinx RapidIO核详解
一.RapidIO核概述 RapidIO核的设计标准来源于RapidIO Interconnect Specification rev2.2,它支持1x,2x和4x三种模式,每通道的速度支持1.25G ...
- 机器学习入门13 - 正则化:稀疏性 (Regularization for Sparsity)
原文链接:https://developers.google.com/machine-learning/crash-course/regularization-for-sparsity/ 1- L₁正 ...
- vis.js没有中文文档,个人在项目中总结的一些中文配置
##vis.js var options = { nodes:{//节点配置 borderWidth: 1,//节点边框的宽度,单位为px borderWidthSelected: 2,节点被选中时边 ...
- 【转载】“宇宙最强” IDE,Visual Studio 2019 正式发布
转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 本文由葡萄城翻译并发布 今天凌晨Visual Studio 2019已经正式发布,现在已经可以下载了.使用V ...
- 一些不常用但又很有用的css小tips
1.box-sizing:border-box box-sizing有三个属性:content-box(默认值) || border-box || inhreit.第一个自然不用说,比如我们设置一个d ...
- File Explore 中data权限修改,实体机
如图: 1)root手机,360root 2)RootBrowser 改权限 3)ok
- 浅入浅出Typescript Decorators
临时起的兴趣,想写一篇关于ts decorator的文章,就花小半天整理了一下... 这东西,在ES2017里好像也有... 文档的话看这里. 因为临时,就没想写太多文字介绍,带少许文字说明直接开撸 ...
- vue-07-自定义指令
1, 全局指令 在main.js中引入 // 注册一个全局自定义指令 `v-focus` Vue.directive('focus', { // 当被绑定的元素插入到 DOM 中时…… inserte ...
- Linux常用命令之帮助和用户管理命令
目录 1.帮助命令 一.获得命令或配置文件帮助信息:man 二.获得shell内置命令的帮助信息:help 三.获得命令的中文帮助信息:--help 2.用户管理命令 一.添加新用户:useradd ...