1846543 Members
2088 Online
110256 Solutions
New Discussion

pipe question

 
SOLVED
Go to solution
Tim Medford
Valued Contributor

pipe question

I should know the answer to this but here goes anyway...

When you run a command and pipe it to another command, does command1 finish completely BEFORE it begins piping the results to command2 or does it start as soon as it has come results?

For example:

find /ora_* -name *.dbf | xargs -i -t cp -p {} /ora_backup/...

Would the first file found get immediately piped to the cp command while the find command is still locating other files? Or do they all get fed in at once?

Thanks in advance,
Tim
3 REPLIES 3
harry d brown jr
Honored Contributor

Re: pipe question

buffered IO

live free or die
harry
Live Free or Die
Robert Thorneycroft
Valued Contributor
Solution

Re: pipe question

The copy will start as soon as find locates the first match.

Kind regards,

Robert Thorneycroft
S.K. Chan
Honored Contributor

Re: pipe question

The process after the pipe "function" will read the output from the first process (before the pipe) and as soon as the first "returned" output is found it gets processed immediately by whatever command you put after the pipe.