title: Write mplayer's output to fifo and read it
body: <p>I'm trying write simple notify app in bash. I want to read output from mplayer, parse it and display through notify-send.</p>
  
  <p>I can get desired info from mplayer using this:</p>
  
  <pre><code>mplayer &lt;url&gt; | grep ICY
  </code></pre>
  
  <p>and then parse in using sed.</p>
  
  <p>I create named pipe, tell mplayer to write it and then I'm reading from it. Unfortunately, it doesn't work. Here's my script:</p>
  
  <pre><code>$fifo=~/.rp/fifo
  mkfifo $fifo
  
  mplayer &lt;url&gt; 2&gt;/dev/null | grep ICY 1&gt; $fifo &amp;
  
  while read line &lt; $fifo; do
      echo $line
  done
  
  wait
  </code></pre>
  
  <p>Program keeps waiting to input from $fifo. I tried following in other terminal, while this script is running:</p>
  
  <ol>
  <li><p>Run</p>
  
  <pre><code>echo "Test" &gt; .rp/fifo
  </code></pre>
  
  <p>Terminal with running script shows "Test"</p></li>
  <li><p>Run</p>
  
  <pre><code>echo "ICY" | grep ICY &gt; .rp/fifo
  </code></pre>
  
  <p>also works.</p></li>
  <li><p>Run</p>
  
  <pre><code>mplayer &lt;url&gt; | grep ICY &gt; .rp/fifo
  </code></pre>
  
  <p>and it <strong>doesn't</strong> work.</p></li>
  </ol>
  
  <p>Is I said above, the combination of mplayer | grep works fine. grep > $fifo works fine. I don't understand why mplayer | grep > $fifo doesn't work. </p>