title: How to know when dd has finished
body: <p>I have a issue with the dd comand. I use it in a while like this:</p>
  
  <pre><code>while c=$(dd count=1000 bs=1 2&gt;/dev/null) ;do
  
      echo -n "$c" &gt; /dev/ttyO5
  done &lt; $FILE
  </code></pre>
  
  <p>And it works like charm, the only problem is that once the file is read completely, it doesnt stop the while, it stays there stalled. How could I make the while to stop once the dd read all the file?</p>
  
  <p>BTW: Note my machine is embed linux, it doesnt have all the comands and tools as a normal ubuntu machine would have.</p>
  
  <p>Thanks</p>
  
  <p>Output <code>dd --version</code></p>
  
  <pre><code>BusyBox v1.20.2 (MUSE) multi-call binary.
  
  Usage: dd [if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]
          [seek=N]
  
  Copy a file with converting and formatting
  
          if=FILE         Read from FILE instead of stdin
          of=FILE         Write to FILE instead of stdout
          bs=N            Read and write N bytes at a time
          count=N         Copy only N input blocks
          skip=N          Skip N input blocks
          seek=N          Skip N output blocks
  
  Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),
  MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)
  </code></pre>