#!/bin/bash # # show generic devices for CDROM SCSI devices # # needs a mounted /proc filesystem, printf, echo and grep # # when invoked with a number, the n-th cdrom SCSI address is # printed. # # example: 'scan_scsi.linux 2' will print the SCSI settings for # the second cdrom device, namely '0,4,0' in my # system. # # BUGS: limited to 9 devices # NUMBER=0 LETTER=a while read ID; do if [ ".${ID%%' '}" = ".Attached devices:" ]; then continue; fi read ignore; read ignore type ignore; echo $ID ' ' $type ' -> ' /dev/sg$NUMBER #echo $ID ' ' $type ' -> ' /dev/sg$NUMBER or /dev/sg$LETTER NUMBER=$(($NUMBER + 1)) #done