#!/bin/bash ## isoread.sh ## Read only the valid portions of an ISO image from a CD disc ## by parsing the isoinfo output and passing that to a suitable dd ## command ## (c) 2005 James T. Dennis: Published under the BSD Licence which isoinfo || { echo "isoinfo not found?" 1>&2; exit 1; } which dd || { echo "dd not found???" 1>&2; exit 127; } which tr || { echo "tr not found???" 1>&2; exit 127; } which egrep || { echo "egrep not found???" 1>&2; exit 127; } eval $(isoinfo -d -i "$1" 2>/dev/null | egrep "block[ ]*size|olume[ ]*size" | { IFS=":"; read x bs; read x vsize; echo "bs=$bs ; vsize=$vsize" | tr -d " "; }) [ -z "$bs" -o -z "$vsize" ] && { echo "Error getting isoinfo $1?" 1>&2; exit 1; } cmd="dd conv=notrunc,noerror if=$1 bs=$bs count=$vsize" echo "$cmd" 1>&2 $cmd