[plug] Bash "Processing" Script

Russell Steicke r.steicke at bom.gov.au
Fri Jun 11 12:33:18 WST 2004


On Fri, Jun 11, 2004 at 12:02:37PM +0800, Jay Turner wrote:
> Hi All,
> 
> I have written a bash script that I can use to image partitions from one
> disk to another using 'dd'.
> 
> As this process can take a while and 'dd' doesn't offer any processing
> information, I was hoping to
> output a '.' to the screen every x seconds while 'dd' does it's thing.
> ie
> 
> Imaging............
> 
> With a new dot appearing after x seconds.
> 
> Does anyone have any ideas on the best way to do this?

Dunno about the best way, but here's one way.  Do this in multiple dd
invocations:

  # Untested...
  echo -n Imaging
  Skip=0
  while true ; do
    dd bs=1M if=/dev/foo of=/dev/bar skip=$Skip || break
    Skip=$((Skip+1))
    echo -n .
  done
  echo

There's a bit of process overhead in this, but it should all be in cache
so it might not be a big deal.  Plus you don't need to run dd
background, so you don't miss out on error messages like you do with the
solutions that to ">/dev/null 2>&1".




-- 
Russell Steicke

-- Fortune says:
Mother Earth is not flat!



More information about the plug mailing list