The script is as follows :#! /Bin/bash ['whoam' = "root"] | cmd = "gksudo" # cmd = gksudocount = 0dir = "/media/cdrom $ count" if it is not root" # Set the mount point uid = $ 2whiledf | grep-q $ dir2 & gt; /dev/null # Whether the mount point uses doecho $ dirletcount = $ count + 1
The script is as follows:
#! /Bin/bash
['Whoam' = "root"] | cmd = "gksudo" # if it is not root, cmd = gksudo
Count = 0
Dir = "/media/cdrom $ count" # Set a mount point
Uid = $2
While df | grep-q $ dir 2>/dev/null # Whether the mount point is used
Do
Echo $ dir
Let count = $ count + 1
Dir = "/media/cdrom $ count" ### new mount point
Done
Echo $ dir
### Using gksudo requires the root permission
If [! -D $ dir]; then
$ Cmd "mkdir-p $ dir" # create a mount point
Fi
If mount | grep $1; then
Exit 0
Fi
If [-f $1]; then
Echo "$1 mount on $ dir"
$ Cmd "mount-t iso9660-o ro, loop, uid = $ UID, utf8 $1 $ dir" ### mount
Fi
For dir in/media/cdrom [1-9] *
Do
$ Cmd "rmdir $ dir" ##### Remove useless Directories
Done
Usage:
1. Write the code to a file such as iso_mount.
2. grant execution permission: chmod + x iso_mount
3. Right-click the iso Image File
It is easy to use in Ubuntu 8.04, but the anti-mount command of right-click does not work, and the anti-mount cdrom needs to be remounted:
Sudo umount/media/cdrom