Hide cat errors -


( find -print0 | xargs -0 cat ) | wc -l (fromhttp://stackoverflow.com/questions/1358540/how-to-count-all-the-lines-of-code-in-a-directory-recursively) prints total number of lines in files in subdirectories. prints bunch of lines cat: ./x: directory.

i tried ( find -print0 | xargs -0 cat ) | wc -l &> /dev/null (and 2> /dev/null , > /dev/null 2>&1) messages still printed shell.

is not possible hide output?

( find -type f -print0 | xargs -0 cat ) | wc -l overcomes problem, i'm still curious why redirecting stderr doesn't work, , if there more general purpose way hide errors cat.

you need redirect stderr stream of cat command /dev/null. have done redirected stderr stream of wc. try this:

( find -print0 | xargs -0 cat 2>/dev/null ) | wc -l 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -