The command I use for copying CD/DVD images is
dd if=/dev/sr0 of=/home/freeman/cd_image/cdname.iso
This command is pretty straight forward, the dd stands for disk dump, if stands for input file and of stands for output file. So I do not have problem with remembering the command.The issue I have is remembering how to mount iso files on Linux, the mount options.
So I decided to write a shell script for interactively mounting any iso image in any mount point (which is often an empty folder).
The following is a step-wise description of the shell creation
STEP 1
I created a special folder in my home folder and named it shell, using the following command
[freeman@freeman ~]$ mkdir shell
I changed directory to the shell subdirectory I just created
[freeman@freeman ~]$ cd shell
STEP 2
I created a new file (named it mountiso) and entered the script in in using vi editor
[freeman@freeman shell]$ vi mountiso
#!/bin/bash
#This shell is for mounting cd images from anywhere to any empty folder
echo -n "Enter the full path of the iso image: "
read image
echo -n "Enter the full path of the mount point, an empty folder: "
read folder
mount -t iso9660 -o loop $image $folder
exit 0
STEP 3
I made the mountiso file executable by changing it's file permissions
[freeman@freeman shell]$ chmod a+x mountiso
I also included the /home/freeman/shell path in the PATH environment variable
[freeman@freeman shell]$ PATH=$PATH:/home/freeman/shell
To make is global, I exported the new PATH
[freeman@freeman shell]$ export PATH
So that was all, to run the new script I just enter mountiso (regardless of my current working directory) and enter both the image location and mount point without bothering about the mount options.
0 comments:
Post a Comment
You can be sure of a response, a very relevant one too!
Click on Subscribe by Email just down below the comment box so you'll be notified of my response.
Thanks!