1. 标准输入 (stdin):代码为0,使用<或<<;
2. 标准输出 (stdout):代码为 1 ,使用 > 或 >> ;
3. 标准错误输出(stderr):代码为 2 ,使用 2> 或 2>> ;
-
1> :以覆盖的方法将『正确的数据』输出到指定的文件或装置上;
-
1>>:以累加的方法将『正确的数据』输出到指定的文件或装置上;
-
2> :以覆盖的方法将『错误的数据』输出到指定的文件或装置上;
-
2>>:以累加的方法将『错误的数据』输出到指定的文件或装置上;
standard input:<与 <<
< 代表:『将原 本需要由键盘输入的数据,改由文件内容来取代』。
<< 代表:输入结束的意思
范例一:利用 cat 指令来建立一个文件的简单流程
[dmtsai@study ~]$ cat > hi2
testing
cat file test
<==这里按下 [ctrl]+d 来离开
************************************
范例二:新建文件hi1,并将hi 文件内容输入到hi1 中。代码如下:
[root@rfjmy7h77vmu src]# cat > hi1 <hi
[root@rfjmy7h77vmu src]# ll
-rw-r--r-- 1 root root 58 Jun 23 12:07 hi
-rw-r--r-- 1 root root 58 Jun 23 12:22 hi1
*****************************************
[root@rfjmy7h77vmu src]# cat > ni << 'who'
> i am alisa
> who <==输入这关键词,立刻就结束而不需要输入 [ctrl]+d