title: Visually update size of file during mysql dump via tunnel
body: <p>I have a bash script called <code>copydata</code> which does the following to do a MySQL dump of specific tables from our production MySQL server to a local file, and then push it into my local MySQL database.</p>
  <pre><code>#!/bin/sh
  #set up tunnel
  ssh -f -i ~/.ssh/ec2-eu-keypair.pem -o CompressionLevel=9 -o ExitOnForwardFailure=yes -L 3307:elr2.our-id.eu-west-1.rds.amazonaws.com:3306 username@example.com
  
  echo &quot;Dumping tables \&quot;$@\&quot; to /tmp/data.sql&quot;
  #dump tables to local file
  mysqldump -u root -h 127.0.0.1 -pmypass  -P 3307 live_db_name  --extended-insert --single-transaction --default-character-set=utf8 --skip-set-charset $@ &gt; /tmp/data.sql
  pv /tmp/data.sql | mysql -u root local_db_name --default-character-set=utf8 --binary-mode --force
  
  </code></pre>
  <p>So, it is called like <code>copydata table1 table2</code></p>
  <p>It works, but the <code>mysqldump</code> part can take a very long time, and it would be nice to have some visual feedback on progress.   One thing which occurred to me is that I could show the size of <code>/tmp/data.sql</code> while the dump is in progress - if I just keep doing the following, in a seperate tab, for example, I can see it going up at the rate of approx 2mb per second:</p>
  <pre><code>ls -lh /tmp/data.sql
  </code></pre>
  <p>Can I add the above command, or something similar, to the above script so that I can see the file size updating while i'm waiting for the mysqldump line to complete?</p>