I'm using command | grep -v "JavaScript strict warning" to filter the output of a command (hiding warnings). The grep command works fine when I test it like this:

$ printf "JavaScript strict warning: warning\nNot a warning\nJavaScript strict warning: warning\nJavaScript strict warning: warning\n" | grep -v "JavaScript strict warning"

The output is:

Not a warning

However, when I filter the running output, lines with JavaScript strict warning still come through. I believe that it's happening because the original command is spawning another process. Is there a way to keep filtering the output of the new process?

  • 1
    the output you see may be stdout and stderr, but a pipe only passes on stdout.
    – MaQleod
    Commented Mar 12, 2014 at 21:40
  • @MaQleod is there a way to know if it's stderr? Is there a way to pass stderr to another pipe? Commented Mar 13, 2014 at 1:10
  • Actually, just figured it out. I added 3>&1 1>&2 2>&3 before the pipe, and everything works. Thanks for the correct diagnosis! If you add an answer I'll accept it. Commented Mar 13, 2014 at 1:17

1 Answer 1


the output you see is likely stderr - a pipe only passes on stdout by default.

As you noted in your comment you can use redirects to adjust what gets passed on.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .