The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to convert epoch into human-readable snoman1 Shell Programming and Scripting 3 04-18-2008 12:59 PM
script check the users in SHELL ? anything Shell Programming and Scripting 3 02-01-2008 07:38 AM
Check EOF in shell script ideazhcy Shell Programming and Scripting 8 07-20-2007 12:29 PM
check my first shell script gridview Shell Programming and Scripting 2 05-14-2007 12:34 PM
check in unix shell script so that no one is able to run the script manually adi_bang76 Shell Programming and Scripting 1 11-16-2006 06:43 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-13-2008
Registered User
 

Join Date: May 2008
Posts: 39
Stumble this Post!
Shell script that would check if the CD-rom is readable

Hi,

I was wondering if there's a command in Linux that would check to see if a CD is inserted into CD-rom.

I am developing a shell script that would copy a file from CD rom. For this, I have to first verify if the CD has been inserted or not.

Can anyone help me?


Thanks,
Sundeep
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-13-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 709
Stumble this Post!
This would depend on the distribution of linux really, but it's largely going to be down to your automounter. If you are using one, then just use something like:
Code:
if mount | grep cdrom > /dev/null
...
.
If not, then you'll need to test the device - easiest way would be to mount it IMO, something like:
Code:
if mount /mnt/cdrom
...
You might need to first check if it's already mounted, and possibly include a step to unmount it again if you need it unmounted.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0