ejectiing a cdrom from the command line

The cd/dvd drive, which is usually ejected by pressing the button on the drive can also be controlled from the command line. The command to eject the drive from the command line is

The command works only on a Desktop and is not useful in laptops
Here is small fun script to play a prank on some one,
The script keeps ejecting and closing the cdrom cover repeatedly ,untill the script is not killed or the terminal from which the script was launched is not closed.

Save the script and give it execute permissions

execute it

and see the fun with the cd drive popping out and in all by itself.
You can kill it by pressing cntrl+c or closing the terminal from where the script was launched.

Follow by Email