Last active
August 29, 2015 14:08
-
-
Save idserda/b2895df077676e012bbe to your computer and use it in GitHub Desktop.
Simple bash script for Mac OS X to write a disk image to removable media (sd card) or another file, with progress information
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 | |
NUMARGS=2 | |
if [ $# -ne $NUMARGS ] | |
then | |
echo "Usage: `basename $0` </dev/diskN> <file.img>" | |
exit | |
fi | |
DEVICE="$1" | |
IMAGE="$2" | |
diskutil unmountDisk $DEVICE | |
dd if=$IMAGE bs=1m | pv -ptre $IMAGE | dd of=$DEVICE bs=1m | |
diskutil eject $DEVICE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment