1

Sometimes my CD-ROM is mapped to /dev/sg0 and sometimes to /dev/sg1. How do I detect the currently mapped device in a bash script?

Hendré
  • 759

1 Answers1

0

Assuming the cdrom is already mounted (it normally mounts automatically when a CD is inserted), just run the following command:

mount | grep ^'/dev/sg' | awk '{print $1}'
green
  • 14,306