Originally Posted by danielbmartin
I have not ignored your advice. To my eyes, the cat improves code readability. Since it performs no logic I assume the cost of the cat is negligible, particularly in code where it is the first of a long string of piped commands. I have not tested this assumption and may be wrong.
Daniel B. Martin
Well a "grep 'something' inputFile doesn't either perform any logic to get it's input.
And you are spawning a subprocess.
This script might stop, if there are no more process ids available while the script without the useless use of cat would still work.
Admitted a very rare condition.
But imagine running the cat construct in a long running loop you WILL see a a heavy performance penalty.
I can't get the point of readability.
The "grep what where" pattern is to basic to be unreadable imho
The more you use the more errors can arise.
Are you aware of the buffering mechanism which bash does when it comes to piping?
The source of subtle failures.
Adhere to the KISS KeepItStupidSimple pattern.
Do only do what really is required.