articles/pipe.md: update
This commit is contained in:
parent
e9675c0eaa
commit
0f10be2d20
1 changed files with 5 additions and 5 deletions
|
@ -1,19 +1,19 @@
|
||||||
# Pipe
|
# Pipe
|
||||||
A pipe is an unidirectional IPC mechanism used first in the [Unix](unix.md) operating system, used to connect one
|
A pipe is an unidirectional IPC mechanism used first in the [Unix](unix.md) operating system, used to connect one
|
||||||
or multiple processes (then forming a pipeline). Pipes are a central concept in Unix-like operating systems as it
|
or multiple processes together (then forming a pipeline). Pipes are a central concept in Unix-like operating systems as it
|
||||||
allows the composition of multiple programs results without using temporary files.
|
allows the composition of multiple programs results without using temporary files.
|
||||||
|
|
||||||
In a shell a pipeline is constructed using the `|` character which by default redirect the process stdout
|
In a shell a pipeline is constructed using the `|` character which by default redirect the process stdout
|
||||||
output to the stdin of the process at the right of the pipe.
|
output to the stdin of the process at the right of the pipe.
|
||||||
```sh
|
```sh
|
||||||
A | B | C | D
|
cmdA | cmdB | cmdC | cmdD
|
||||||
```
|
```
|
||||||
|
|
||||||
## Named pipes
|
## Named pipes
|
||||||
A named pipe also known as a FIFO, is a pipe that is represented as a file on a disk having similar semantics
|
A named pipe also known as a FIFO, is a pipe that is represented as a file on a disk having similar semantics
|
||||||
to a regular file.
|
to a regular file.
|
||||||
```sh
|
```sh
|
||||||
mkfifo foo
|
mkfifo foo # create named pipe
|
||||||
cat foo &
|
cat foo & # will block until something is written to it
|
||||||
echo 'test' > foo
|
echo 'test' > foo # send data through the pipe
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue