Last active
September 25, 2015 17:29
-
-
Save moritzmhmk/5ca136d5295003b4a7c8 to your computer and use it in GitHub Desktop.
improved dd with percentage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
in="$1" | |
out="$2" | |
if [[ $# -ne 2 ]] ; then | |
echo "Usage: $0 <input> <output>" | |
exit | |
fi | |
if [ "$(uname)" == "Darwin" ]; then | |
size=`stat -f "%z" $in` | |
dd if="$in" bs=4m | pv -s $size | dd of="$out" bs=4m | |
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then | |
size=`stat -c %s "$in"` | |
dd if="$in" bs=4M | pv -s $size | dd of="$out" bs=4M | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment