Created
October 31, 2015 12:20
-
-
Save leoh0/d07787e9dc635136de6a to your computer and use it in GitHub Desktop.
write access ntfs disk for mac os
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
#!/usr/bin/env bash | |
if mount | grep -q 'ntfs' ; then | |
if ! mount | grep -q 'read-only' ; then | |
echo -e "\033[01;36mExist already in /etc/fstab.\033[00m" | |
VOLUME=$(mount | grep "(ntfs, " | sed 's|/dev/disk[0-9]s[0-9] on \(.*\) (ntfs,.*$|\1|g') | |
open "$VOLUME" | |
exit | |
fi | |
DISK=$(mount | grep 'read-only' | awk '{print $1}') | |
UUID=$(diskutil info $DISK | grep UUID | awk '{print $3}') | |
echo -e "\033[01;36mRegistry into /etc/fstab.\033[00m" | |
echo "UUID=$UUID none ntfs rw,auto,nobrowse" | sudo tee -a /etc/fstab > /dev/null | |
diskutil umount $DISK | |
diskutil mount $DISK | |
VOLUME=$(mount | grep "(ntfs, " | sed 's|/dev/disk[0-9]s[0-9] on \(.*\) (ntfs,.*$|\1|g') | |
open "$VOLUME" | |
else | |
echo -e "\033[01;36mThere is no ntfs disk in here.\033[00m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment