Created
November 19, 2016 05:39
-
-
Save tt6746690/e2107586f47172f5cac48a8063555230 to your computer and use it in GitHub Desktop.
mount ntfs
This file contains hidden or 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 | |
# enable writing to NTFS drives | |
function mount { | |
diskutil list | |
echo “please enter the ntfs disk to be mounted:” | |
read inp | |
#### http://mywiki.wooledge.org/BashFAQ/031#np2 | |
if [[ $inp =~ ^.*(disk0).*$ || $inp =~ ^.*(disk1).*$ ]]; then | |
echo dangerous input! | |
mount | |
else | |
diskutil unmount /dev/$inp | |
mkdir /Volumes/NTFS | |
ntfs-3g /dev/$inp /Volumes/NTFS | |
open /Volumes/NTFS | |
fi | |
} | |
while true; do | |
read -p “mount_to_enable_WRITE?” yn | |
case $yn in | |
[Yy]* ) mount; break;; | |
[Nn]* ) exit;; | |
* ) echo “Please answer yes or no.”;; | |
esac | |
done | |
# === ALTERATIONS === | |
# OS X does not support writing to NTFS format HD, therefore install FUSE and | |
# ntfs-3g, HOWEVER there is a problem. | |
# originally for /sbin/mount_ntfs | |
# mount_ntfs -> /System/Library/Filesystems/ntfs.fs/Contents/Resources/mount_ntfs | |
# symlinked replaced with | |
# mount_ntfs -> /usr/local/Cellar/ntfs-3g/2016.2.22/sbin/mount_ntfs | |
# but can’t be done due to OS X security. Therefore use the following | |
#sudo mkdir /Volumes/NTFS | |
#diskutil list | |
#sudo ntfs-3g /dev/disk2s1 /Volumes/NTFS | |
#open /Volumes/NTFS | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment