>, < 表示数据的流动方向,比如
command < inputfile #表示把 inputfile 中的内容作为标准输入(STDIN)提供给 command
command > outputfile #表示把 command 产生的标准输出(STDOUT)导进 outputfile 中保存。如果 outputfile 不存在,就自动创建,如果已存在,就擦除旧内容然后写入。
>> 表示向文件中追加数据
command >> outputfile #会把 command 产生的标准输出 ( STDOUT ) 导进 outputfile, 追加到 outputfile 已有的内容后面。
<< 表示内联输入重定向(inline input redirection),需要一个文本标记来划分输入数据的开始和结尾
command << input #这里 input 就是“文本标记”,此后的内容就是输入,导向标准输入(STDIN)
xxxxx
xxxxx
xxxxx
input # 结束重定向
| 表示管道
command1 | command2 # command1 每产生一行标准输出 (STDOUT),立即重定向,作为输出流向 command2 ls | sort | more # ls 的结果重定向给 sort,然后给 more,more 显示第一页结果,如果需要更多结果则往下滚动。
原文:https://www.cnblogs.com/luyi07/p/12879982.html