shell编程1.3: 文件与重定向
2018-09-10 本文已影响11人
赵伯舟
1. 文件描述符
shell内的文件描述符对应为:0-stdin, 1-stdout, 2-stderr
2. 重定向
使用>
和>>
进行重定向,其中>
是重写,而>>
是追加:
$ echo "This is a sample text 1" > temp.txt
$ echo "This is a sample text 2" >> temp.txt
shell内的文件描述符对应为:0-stdin, 1-stdout, 2-stderr
使用>
和>>
进行重定向,其中>
是重写,而>>
是追加:
$ echo "This is a sample text 1" > temp.txt
$ echo "This is a sample text 2" >> temp.txt