1. Basic Concepts
A, I/O redirection is usually related to FD, Shell FD is usually 10, namely 0~9;
b, commonly used FD has 3, for 0 (stdin, standard input), 1 (stdout, standard output), 2 (stderr, standard error Output), the default and keyboard,
Piping (pipe)In Linux, pipelines are also a kind of file, but more special, we can use the pipe function to create a pipeline, its prototype is declared as follows:# Inlcude intpipe (int fields[2]); tune? Use the pipe function to open up in the
1 redirects1.1 Redirect Symbol> Output redirected to a file or device overwriting the original file>! Output redirected to a file or device forcing overwriting of the original file>> output redirected to a file or device to append the original file1.
2015.3.3Tuesday CloudyIPC: Inter-process communicationPipe: Nameless Pipes: can only be used between processes that have affinityFIFO: Well-known pipeline: can make each other two processes communicate with each other, the famous pipeline can be
Contains 3 types of data streams:• Standard input (stdin): code 0, Symbol or >>; standard error Output (STDERR): Code 2, Symbol 2> or 2>>. •>Default iscoverFile contents, if you want toAppendThen use>>Entering or outputting data from a specified
Standard I/O and pipingStandard inputs and outputsThe program is made up of instruction + dataThere are three types of data flow in the program:Input data flow: Output data stream:--> standard output (stdout), general default to terminal windowError
The command behavior of Linux we provide a pipeline and redirection mechanism that enables multi-command collaboration through pipelines and redirects.The data flow of the command-line shell is defined in the following three ways:
I. Interpreting redirectsThe program must be able to read input and then be processed to display the results, the program to obtain a variety of data, the program produced a variety of results. In other words, the program must have the output to
interprocess communication Fork Pipe pie_t usage (pipeline mechanism communication) Each process has a different user address space, the global variables of any one process can not be seen in another process, so the process to exchange data between
1. Before we get to the redirect, let's look at the file descriptor for Linux.Linux file Descriptor : Can be understood as Linux in order to track open files, and the allocation of a number, (people are based on the file name tracking files, the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.