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 ...
随机推荐
- BigDecimal比较2个值是否相等,不能用equals,而要用compareTo
BigDecimal比较相等,不能用equals,要用compareTo
- Windows 10 IoT Serials 10 – 如何使用OCR引擎进行文字识别
1. 引言 OCR (Optical Character Recognition,光学字符识别)是指电子设备(例如扫描仪或数码相机)检查纸上打印的字符,通过检测暗.亮的模式确定其形状,然后用字符识别方 ...
- 爱上python之盲注探测脚本
本文转自:i春秋论坛 前言: 最近在学python,做了个盲注的简单的跑用户的脚本,仅做个记录. sqmap也有不灵的时候,有时需要根据情况自写脚本探测 正文: 本地用大表姐给的sql和p ...
- webpack vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin
当我们出现以下报错! 解决方案: // webpack配置文件 const path = require('path'); const htmlWebpackPlugin = require('htm ...
- 怎么让Word形状里的文字上下左右居中
怎么让Word形状里的文字上下左右居中? 第一:左右居中,用段落居中方法: 第二:上下居中,选定图形,单击鼠标右键并选择“设置形状格式”,在选项卡的“文本框”中,选择中部对齐 效果图:
- salesforce零基础学习(九十三)Email To Case的简单实现
Salesforce提供了标准的功能来实现通过Email 创建 Case.我们可以设置指定的路由的地址,指定条件的邮件会自动生成到目标salesforce系统的Case数据.Salesforce提供了 ...
- [转]迄今为止最优的Eclipse运行性能调优 ,含eclipse.ini
最近,Eclipse(Eclipse-JEE3.5)运行十分缓慢(可能插件安装过多),因此,得到了个机会调优一下,以便提高工作效率 下图是未经任何调整eclipse的gc情况(使用jvisualvm命 ...
- 关于EF的三种分类----CodeFirst
新建StudentInfo.cs using System; using System.Collections.Generic; using System.ComponentModel.DataAnn ...
- DNS服务器的搭建
更详细的dns笔记整理: http://services.linuxpanda.tech/DNS/index.html 1 DNS介绍 DNS(Domain Name System,域名系统),因特网 ...
- Deploying Keras model on Tensorflow Serving--
keras训练了个二分类的模型.需求是把keras模型跑到 tensorflow serving上 (TensorFlow Serving 系统用于在生产环境中运行模型) keras模型转 tenso ...