Created
November 16, 2014 13:13
-
-
Save jsfaint/b8b4664136dedeca6064 to your computer and use it in GitHub Desktop.
Enable/Disable Mac build-in NTFS written. e.g.: ./ntfsutil.sh (m/u) /dev/disk2s1
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
#!/bin/bash | |
mount_disk() | |
{ | |
sudo umount $disk | |
mkdir ~/Desktop/$diskname | |
sudo mount_ntfs -o rw,auto,nodev,nobrowse,noowners,noatime $disk ~/Desktop/$diskname | |
echo "Mount $disk to ~/Desktop/$diskname" | |
open ~/Desktop/$diskname | |
} | |
umount_disk() | |
{ | |
sudo umount $disk | |
echo "Unmount $disk from ~/Desktop/$diskname" | |
rmdir ~/Desktop/$diskname | |
} | |
#Start from here | |
if [[ $# -ne 2 ]]; then | |
echo "$0 m|u /disk/diskXsX" | |
exit 1 | |
fi | |
oper=$1 | |
disk=$2 | |
diskname=`basename $disk` | |
case $oper in | |
m) | |
mount_disk | |
;; | |
u) | |
umount_disk | |
;; | |
*) | |
echo "unknown operation" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment