Skip to content

Instantly share code, notes, and snippets.

@calee0219
Created April 4, 2019 14:00
Show Gist options
  • Save calee0219/bb822b675cba9cb08f9fc9e320f9716c to your computer and use it in GitHub Desktop.
Save calee0219/bb822b675cba9cb08f9fc9e320f9716c to your computer and use it in GitHub Desktop.
#!/bin/bash
disk=`df -h | awk '{ print $1 }' | grep /dev/s | awk 'NR == 1' | cut -c1-8`
to_disk=`ls -1 -d /dev/s* | egrep -x '/dev/s[abcd]+'`
for arg in ${to_disk}
do
if [ ${arg} != ${disk} ]
then
target=${arg}
fi
done
lsblk
read -p "Which disk do you want to install? [${target}]: " ans
target=${ans:-$target}
source=${disk}2
read -p "Burn Windows from ${source} to ${target}? [y/N]: " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
cmd="time sudo dd if=${source} of=${target} bs=512"
$cmd
echo
echo "Completed!!!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment