Small example: Mount removable media

Source: Internet
Author: User

#/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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.