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 and shell scripting languages 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 04:59 PM
script check the users in SHELL ? anything Shell Programming and Scripting 3 02-01-2008 11:38 AM
Check EOF in shell script ideazhcy Shell Programming and Scripting 8 07-20-2007 04:29 PM
check my first shell script gridview Shell Programming and Scripting 2 05-14-2007 04: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 10:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-13-2008
eamani_sun eamani_sun is offline
Registered User
  
 

Join Date: May 2008
Posts: 40
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
  #2 (permalink)  
Old 05-13-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:13 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0