1.管道流

  在linux中  | 符号代表管道流

  用法:command1 | command2

    第一个命令的标准输出将作为第二个命令的标准输入

    例:cat a.txt | grep "abc"

2.IO流

  stdin --- 标准输入流,描述符为0

  stdout --- 标准输出流,描述符为1

  stderr --- 标准错误流,描述符为2  

3.重定向

  输出:

    n>  重定向--覆盖

      例:cat a.txt 1>stdout.txt

        将cat a.txt 的输出内容重定向到stdout.txt,不在终端显示

        若 stdout.txt存在,则覆盖,不存在,创建

    n>>  重定向--添加

      例:cat a.txt 1>>stdout.txt  

        将cat a.txt 的输出内容重定向到stdout.txt,不在终端显示

        若 stdout.txt存在,则在文件末尾添加,不存在,创建

    说明:1.n代表3中IO流的描述符,若n省略,默认为标准输出流

  输入:

    <

      例:./a.out <a.txt

       将a.out程序的输入定想到a.txt

参考:http://www.ibm.com/developerworks/cn/linux/l-lpic1-v3-103-4/

相关文章:

  • 2022-01-14
  • 2022-12-23
  • 2021-11-08
  • 2021-10-05
  • 2021-05-25
  • 2021-08-06
  • 2021-12-14
猜你喜欢
  • 2021-07-30
  • 2022-12-23
  • 2021-10-27
  • 2021-06-28
  • 2021-09-10
  • 2022-01-03
  • 2022-01-24
相关资源
相似解决方案