Answers

Question and Answer:

  Home  Solaris

⟩ What is "Piping" solaris?

piping:- sending the output of a command to the input of another is called piping.

some examples are:

$cal | wc

will output total line's,word's and character's

$cal | wc | wc

will output total line's,word's and character's

A unix pipe provides a one-way flow of data.

For example, if a Unix users issues the command

$who | sort |lpr

then the Unix shell would create three processes with two pipes between them:

A pipe can be explicitly created in Unix using the pipe system call. Two file descriptors are returned--fildes[0] and fildes[1], and they are both open for reading and writing. A read from fildes[0] accesses the data written to fildes[1] on a first-in-first-out (FIFO) basis and a read from fildes[1] accesses the data written to fildes[0] also on a FIFO basis.

When a pipe is used in a Unix command line, the first process is assumed to be writing to stdout and the second is assumed to be reading from stdin. So, it is common practice to assign the pipe write device descriptor to stdout in the first process and assign the pipe read device descriptor to stdin in the second process. This is elaborated below in the discussion of multiple command pipelines.

 175 views

More Questions for you: