#!/bin/bash
#
# show generic devices for CDROM SCSI devices
#
# needs a mounted /proc filesystem and grep
#

NUMBER=0
while read ID; do
	if [ ".${ID%%' '}" = ".Attached devices:" ]; then
		continue;
	fi
	read ignore;
	read ignore type ignore;
	echo $ID '  ' $type ' -> ' /dev/sg`printf "\x$[$NUMBER + 61]"` or /dev/sg$NUMBER
	NUMBER=$[$NUMBER + 1]
#done <test_scanscsi | grep "WORM\|CD-ROM"
done </proc/scsi/scsi | grep "WORM\|CD-ROM"
