2010年4月1日 星期四

寫個掛載磁碟的script

因為常用隨身碟,又沒用自動掛載

所以覺的寫個掛在磁碟的script比較方便些
script的名為mount.bat

#/bin/sh
echo "Mount all devices..."
echo "The Program by Hrsen.Shen"

if [ "$1" == "" ]; then
echo "Not has device ..."
echo "Plese selection devices.."
echo "The Program ex: ./mount.bat device direct format "
echo "device: hda1,hdb1,hdc1,sda1,sdb1... can look /dev/"
echo "format: no any word is linux format,have word is 'win',use windows format "
exit 0;
fi

if [ "$3" == "win" ]; then
echo "Use Windows format.."
su -c "mount /dev/'$1' '$2' -o iocharset=utf8,uid=hrsenshen"
else
echo "Use Linux format.."
su -c "mount /dev/'$1' '$2'"
fi
echo "parameteris => $@"
echo "Mount device '$1' to direct '$2'"

這樣要掛啥碟就不用打太多文自哩

沒有留言: