Linuxshell programming ---- Pipeline + I/O redirection

Source: Internet
Author: User
Linuxshell programming ---- Pipeline + IO redirection 1 pipeline introduction 1 pipeline technology is a basic inter-process communication technology in Linux. it uses the first-in-first-out queuing model to direct inter-process communication. For pipelines, we can visually understand it as a one-way connector connecting two entities Linux shell programming ---- Pipeline + I/O redirection 1 pipeline introduction 1 pipeline technology is a basic inter-process communication technology in Linux, it uses the first-in-first-out queuing model to control inter-process communication. For pipelines, we can understand it as a one-way connector connecting two entities. in 2 Shell programming, the pipeline symbol is "| ", command1 | command2 | command3 |... | commandn command1 ~ Commandn is n commands. if there is no pipeline, the result is directly displayed in Shell. when the Shell encounters a pipeline, send the following command 2 cat and more Command 1 cat and more to display the file content, their basic format is similar to cat option file more option File 2 cat command option name and its meaning option meaning-a displays all content of the file-B number of all output lines starting from 1, however, empty rows are not numbered.-E is displayed at the end of each row. "$"-n starts from 1 and numbers all output rows.-s is used to replace null rows with more than two consecutive rows. display the option name and its meaning of the 3 more command in a visible format. the option meaning-num indicates the number of rows displayed at a time-f calculates the number of rows, based on the actual number of rows, the number of rows not after the automatic line feed-s when there are two consecutive null rows or more, replace it with a blank row + num to display the maximum number of 4 cat and more commands starting from row num differences Yes, the cat command does not provide the paging function, but the more Command provides the paging function when displaying files with more than one page. 3 I/O redirection 1 I/O redirection is a process, this process captures the output of a file, command, program, script, or even code block, and then sends the captured output to another file as the input, the file identifier of program 2 is an integer from 0 to 9, indicating the source of a specific data stream related to the process. When a process is started in Linux, three files, standard input, standard output, and standard error output, are automatically opened for the process, marked by the file identifiers 0, 1, and 2, respectively, if other files are to be opened, the process starts from the integer 3 to identify 3 basic I/O redirection symbols and their meanings. cmd1 | cmd2 pipeline operator, use the standard output of cmd as the standard input of cmd2> filename: <filename: file filename content as the standard input> filename: append the standard output to filename, if it does not exist, create one first.
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.