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
本文标题:shell编程1.3: 文件与重定向
本文链接:https://www.haomeiwen.com/subject/qxdegftx.html
网友评论