#/bin/bash
[$# = 0] && echo "Usage: $ h,f}" && exit 7
# 1.create Mount Directory
# 2.mount The given flash disk, hard disk, U disk and so on. Belong to Storage Media.
#mount Hardisk or FlashDisk
where_to_mount=${home}//ntfs_hard_disk/
where_to_mount18i=${home}/ntfs_hard_disk18i/
#Auto Find the location of Media.
loc= ' sudo fdisk-l | Tail-n 1 | Cut-d ""-F 1 '
Echo $LOC
# mkdir ${where_to_mount}
#use ' sudo fdisk-l ' find the location of the Storage Media. Then we can mount it.
#H: Hardisk
#F: FlashDisk
if [= = = "H"]; Then
#sudo mount-t ntfs/dev/sdb2 ${where_to_mount}-o gid=${user},uid=${user},umask=022
sudo mount-t ntfs $LOC ${where_to_mount}-o gid=${user},uid=${user},umask=022
elif [= = = "F"]; Then
#sudo mount/dev/sdb1 ${where_to_mount}-o gid=${user},uid=${user},umask=022
sudo mount $LOC ${where_to_mount}-o iocharset=utf8,gid=${user},uid=${user},umask=022
elif [= = "G"]; Then
#sudo mount/dev/sdb1 ${where_to_mount}-o gid=${user},uid=${user},umask=022
#sudo mount/dev/sdb1 ${where_to_mount18i}-o iocharset=utf8,gid=${user},uid=${user},umask=022
sudo mount/dev/sdc1 ${where_to_mount18i}-o iocharset=utf8,gid=${user},uid=${user},umask=022
#sudo mount/dev/sdb1 ${where_to_mount}-o iocharset=utf8,gid=${user},uid=${user},umask=022
Else
echo "What is going to do ..."
Fi
# noter:20130321 by N
# write ' sudo ' in text, when execute, just do './xx.sh '
# no ' sudo ' inside, when execute, do ' sudo./xx.sh '
#The Format of this scritps: [07072013]
#, sudo inside scripts, do './mntxxx {h,f} '
#, sudo not inside scripts, do ' sudo./mntxxx {h,f} '
This article is from the "Andyhdchoice" blog, make sure to keep this source http://andyhdchoice.blog.51cto.com/1521623/1548803
Small example: Mount removable media