LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Checking if a device is mounted using a script (https://www.linuxquestions.org/questions/linux-software-2/checking-if-a-device-is-mounted-using-a-script-149209/)

thar 02-22-2004 01:52 PM

Checking if a device is mounted using a script
 
hi!

i would like to write a script which does the following actions:
1. In case the cdrom is mounted, unmount and eject it.
2. In case it isn't mount it.

Now I have these simple questions:
How do I check if a device is mounted?
How do I eject a cd?

Thanx!

jailbait 02-22-2004 02:07 PM

"How do I check if a device is mounted?"

Use the mount command without any parameters to give you a list of all mounted devices and search the output using grep:
mount | grep (grep parameters)
if test $? -eq 0;
then

"How do I eject a cd?"
Use the eject command.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

thar 02-22-2004 03:17 PM

big thanks.


All times are GMT -5. The time now is 02:38 AM.