How to write a script which can mount/umount ISO?

view full story

http://www.linuxquestions.org – Hi,everyone,I'm new to Linux. I've written a simple script and associated it with ISO files to avoid typing 'sudo mount xxx.iso /mnt/cdrom' over and over again. Code: #!/bin/bash /usr/bin/sudo /bin/mount $1 /mnt/cdrom However, the script above cannot unmount the ISO image. So I still have to type 'sudo umount xxx.iso' over and over again. I want to let the script to judge whether the ISO image is already mounted and if so, unmount the image; if not, mount the image. How to do that? (HowTos)