Exactly, but what i need to do is to ensure the CD is a CD-R, so the data i wrote on that CD is unchangeable for some security reason.
somebody suggested:
media_type="unknown-media"
infotext=$(cdrecord dev=$scsi_adr -atip 2>&1)
if echo "$infotext" | \
grep 'book type:.*DVD+RW' >/dev/null 2>&1
then
media_type="DVD+RW"
elif echo "$infotext" | \
grep 'book type:.*DVD-RW' >/dev/null 2>&1
then
media_type="DVD-RW"
elif echo "$infotext" | \
grep 'book type:.*DVD+R' >/dev/null 2>&1
then
media_type="DVD+R"
elif echo "$infotext" | \
grep 'book type:.*DVD-R' >/dev/null 2>&1
then
media_type="DVD-R"
elif echo "$infotext" | \
grep '^ Is erasable' >/dev/null 2>&1
then
media_type="CD-RW"
elif echo "$infotext" | \
grep '^ Is not erasable' >/dev/null 2>&1
then
media_type="CD-R"
fi
echo "Detected media type : $media_type"
But i'm not familar with shell script, so i haven't found out if this work.