I changed a little your script, it was not working directly for me (ubuntu Hardy heron)

Note : I remove basename because extension .CR2 is not extension cr2
Note : added quote (“) because some files have space in their name

thanks anyway,

(while [ $# -gt 0 ]; do
dcraw -c -a -h “$1” | ppmtojpeg > “$1.jpg”
echo $1
done) | zenity –progress –pulsate –auto-close –auto-kill –text “Converting RAW files to Jpeg”