#!/bin/bash
# script to bincue CDs with cdrdao

unset imgname

echo Input desired image name

read imgname

sudo cdrdao read-cd --read-raw --device /dev/sr0 --datafile /tmp/$imgname.bin /tmp/$imgname.cue

sudo mv /tmp/$imgnanme* /mnt/Data

sudo chmod 777 /mnt/Data/$imgname*
sudo chown john /mnt/Data/$imgname*

sync

read -p "Done. Do you want to run again? (y/n) " -n 1 -r
echo    # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
    eject
    exec /home/john/cdimage.sh
fi