zoukankan      html  css  js  c++  java
  • Ubuntu中输入输出重定向及管道技术简述

    输出

    1、标准输出

      定义:程序在默认情况下输出结果的地方(stdout)。

    2、输出重定向

      定义:用于把数据的输出转移到另一个地方去。

    3、Ubuntu中例子

      $ls > ~/ls_out  ##不显示在显示器上而是输入到文件ls_out中

      uname -r > ls_out  ## output the kernal information to the file of ls_out

      date > ls_out ##output date to file ls_out

      uname >> ls_out  ##add to the tail of ls_out

    输入

    1、标准输入

      定义:默认情况下接受输入的地方。通常指的是键盘。

    2、输入重定向  定义:非标准输入。例如从文件中导入(输入)等。

    3、例子Ubuntu

      $cat < days  ##print the content in the days to the screen

      cat < EOF  ##立即文档,输入到EOF时停止。

      cat << END > hello ##合并使用

    管道 |

      定义:将“重定向”又向前推了一步。通过一个“|”,将一个命令的输出连接到另一个命令的输入。

      例子: ls | grep ruby

      解析:ls首先列出所有文件的文件名,管道“|”接收到这些输出并把他们发送给grep命令作为其输入。最后grep在其中查找包含字符串ruby的文件名,并在标准输出(显示器)上面显示。

  • 相关阅读:
    cocos2d-x Tests讲解 Particle System(粒子系统)
    c++ 知识点
    详解C/C++函数指针声明
    VS中的路径宏 vc++中OutDir、ProjectDir、SolutionDir各种路径
    cocos2d-x学习知识点记录
    Ogre实现简单地形
    Ogre内部渲染流程分析系列
    gcc/g++编译
    gcc和g++的区别
    Hack with rewrite
  • 原文地址:https://www.cnblogs.com/xiangyangzhu/p/redirect_pip.html
Copyright © 2011-2022 走看看