Progress bar for cp

I'm trying to use this code to get a progress bar for cp:

"Can you get cp to give a progress bar like wget?"

But I'm getting these errors:

stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
awk: division by zero
input record number 1, file
source line number 4

I'm using Mac OS X 10.6 with the default bash (#!/bin/sh or #!/bin/bash) shell.

stat is not a standard command, and there are at least two versions in the wild. Their syntax is not the same. Check the man page for your version and adjust the script as necessary.