Most of the time I see someone suggesting using a pipe in a bash script there is someone pointing out not to use it and instead use only one command.
Example:
find $dir -name $pattern
instead of
ls $dir | grep $pattern
Is there another reason than look to avoid pipe?
There is nothing wrong with piping per se. What should be avoided is useless fork()ing, meaning that starting a process is a relatively time-consuming thing.
If something can be done in one process, that is usually better than using two processes for the same result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With