Home > Archive > PERL Beginners > June 2006 > hi
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| rameshbabu 2006-06-27, 7:58 am |
| hi all,
can any body tell me what is a pipe .......in detail ....and
wat does this mean
open (MYPIPE, "| cat >hello");
Thanks
From
Ramesh
| |
|
| In article <1151414103.644247.236050@75g2000cwc.googlegroups.com>,
"rameshbabu" <bhupal78999@gmail.com> wrote:
> hi all,
> can any body tell me what is a pipe .......in detail ....and
> wat does this mean
> open (MYPIPE, "| cat >hello");
>
> Thanks
>
> From
> Ramesh
The simple answer is: a pipe connects two processes together - it
"pipes" the stdout output from the first command to the stdin input of
the second command.
So from the command line, if you enter:
echo "Hi there" | cat > hello
that will pipe the output from echo, "Hi there" to cat which will, in
turn, create a file called 'hello' with the contents "Hi there".
In your example, you are creating a file called "hello", and anything
you print to MYPIPE will be inserted into that file.
It would be equivalent to:
open( MYPIPE, ">hello" )
in effect. The difference is that the pipe starts another process "cat"
to do the actual writing to the file.
You can read about pipes in these manual pages: (look for 'pipeline' )
man sh
man csh
man bash
or in any Unix introduction.
|
|
|
|
|