整天捣鼓嵌入式,兼职搞搞iOS,这么折腾为了啥?都是为了俺的娃!
分类: 其他UNIX
2016-09-15 11:52:40
中秋节闲来无事,顺手写了个脚本。
#!/bin/sh
if [ -z $1 ];then
echo "usage:"
echo "$0 disk_name"
exit
fi
if [ -d /Volumes/$1 ];then
echo "Do you really want to umount /Volumes/$1?[Y/n]"
read a
if [ "$a" != "Y" ];then
exit
else
sudo umount /Volumes/$1
fi
fi
MOUNTDIR=~/Desktop/$1
if [ ! -d $MOUNTDIR ];then
mkdir $MOUNTDIR
fi
DISK=`diskutil list | grep "$1" | awk '{printf $6;}'`
DEVDISK=/dev/$DISK
sudo mount -t ntfs -o rw,auto,nobrowse $DEVDISK ~/Desktop/$1
echo "finished mount ntfs disk $DEVDISK"