Created
October 20, 2015 08:19
-
-
Save NiharG15/17f235b277b3292c6997 to your computer and use it in GitHub Desktop.
Mount / Unmount Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A script to mount / unmount devices. | |
while [ true ] | |
do | |
echo "1. Mount a device" | |
echo "2. Unmount a device" | |
echo "3. Exit" | |
echo "Enter your choice: " | |
read ch | |
case $ch in | |
1) | |
fdisk -l | |
echo "Select a device to mount: " | |
read DEVPATH | |
echo "Contents of /media: " | |
ls /media/ | |
echo "Enter absolute path to a mount point: " | |
read MNTPT | |
if [ ! -e $MNTPT ] | |
then | |
mkdir $MNTPT | |
fi | |
mount $DEVPATH $MNTPT | |
echo "Device mounted at $MNTPT" | |
;; | |
2) | |
echo "Contents of media: " | |
ls /media | |
echo "Enter absolute path to a mount point to unmount device: " | |
read MNTPT | |
umount $MNTPT | |
echo "Device unmounted" | |
;; | |
3) | |
exit | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment