Click to See Complete Forum and Search --> : Help making ?alias?
eXtremist
03-16-2001, 10:20 AM
I want to make a command so that all I need to do is type mountiso file.iso. Can anyone tell me how?
I know to mount the command is mount -t iso9660 -o loop <iso-file> <mount point>
I want it to always mount to /mnt/iso
I'm not really sure how to do this kind of thing in linux.
Kadesh
03-16-2001, 10:29 AM
$ pico mountiso
Enter this stuff:
#/bin/bash
mount -t iso9660 -o loop $1 /mnt/iso
Save and quit
$ chmod 755 mountiso
Then move it to somewhere in your path (~/bin?).
[ 16 March 2001: Message edited by: Kadesh ]
mrBen
03-16-2001, 10:34 AM
Go into your favourite text editor and do something like this:
#!/bin/bash
# first check if there is an argument:
if [ "$#" -ne 1 ]; then
echo "usage: $0 "
fi
mount -t iso9660 -o loop $1 /mnt/iso
....and save it as mountiso either in one of the normal paths (/bin) or edit your path variable to include the new path....
Pants! Someone got in with a reply before me. Oh well, at least if you do it this way it will double check that you have entered the right number of parameters.
[ 16 March 2001: Message edited by: mrBen ]
eXtremist
03-16-2001, 01:01 PM
thank you kindly guys... :)
Actually, I modified that script a little to make it work better (I do have a little programming background)
#!/bin/bash
# first check if there is an argument:
if [ "$#" -ne 1 ]; then
echo "usage: $0 file.iso"
else
mount -t iso9660 -o loop $1 /mnt/iso
fi
[ 16 March 2001: Message edited by: eXtremist ]