#!/bin/csh ############################################################### # This script returns the ID of the CD that is in the drive, # if there is one, and returns nothing if there is not one. # It returns status 0 if there is one, 1 if there is not. ############################################################## set device = '/dev/cdrom' # Find out the ID of the disc that is in the CD device. # Make sure that it is valid. set discid = `cdda2wav -D $device -I cooked_ioctl -v toc -N -J |& grep "CDDB discid" | cut -f 3 -d\ ` if ( 0x != `echo $discid | head -c 2`) then exit 1 endif echo $discid exit 0