Re:Useless Use of Cat Award
by e12e on Wednesday September 11, 2013 @11:25AM
(#6367763)
Wait, what? You mean like this?:
Because otherwise I can't see how a pipeline would be started for each line of a datafile ?
[ Parent
| on HN ]
Sure it's possible without running a subprocess, just open the file on some other filedescriptor.
exec 5<words.txt
while read line <&5 ; do
echo "line read: $line"
done
exec <&5-It's more common to see this issues with something like this:
for f in *;
do
cat $f | ...
done
Now make that a directory with thousands of files or a script digs down through through the tree.