#此腳本用於在Ubuntu環境下拷貝一個文件到共享文件夾中
#contiki_Share為共享文件夾的名字
#!/bin/sh
#function:cp a file(such as xx.hex) to /mnt/hgfs/contiki_Share that is the shared directory
# between xp and vmware ubuntu
#file name: file_cp.sh
#date: 2012-07-29
#example:
#使用方法:file_cp.sh file_name
#parameter detection;檢測是否為一個參數(參數為要拷貝的文件)
if [ $# -ne 1 ]
then
echo "ERROR:there mush be one parameter"
exit
fi
#dir detection;
#共享目錄檢測,用於檢測在ubuntu是否存在共享目錄,如不存在,則掛載
if [ -d /mnt/hgfs/contiki_Share ]
then
echo "dir contiki_Share exist"
else
sudo mount -t vmhgfs .host:/ /mnt/hgfs
fi
echo "$1"
sudo cp ./"$1" /mnt/hgfs/contiki_Share/
echo "$1 has been copied to /mnt/hgfs/contiki_Share/"
#注:運行腳本需要以超級用戶權限運行