1.创建软连接
comproject=/home/test #建立软链接 cd $comproject/src/ rm -rf ipsfe ln -s $ipsfe ipsfe
2.删除文件
rm $comproject/src -rf
3.拷贝文件
将test1文件拷贝至test2文件下
cp $comproject/test1 $comproject/test2/ -rf
4.执行.sh文件
SZX1000058409:/home/compileprj/autoscript # sh copy.sh FSPV3R2C70
5.特殊文件的处理
若文件名存在空格或者.等特殊字符
则访问该文件时,使用\ \隔开,例如
文件a所在路径为
SZX1000058409:/home/test/1 IP LIB/1.00 Head Files/
则在shell脚本中,该路径书写为:
/home/test/\1\ IP\ LIB\/\1.\0\0\ Head\ Files\/a
5.脚本中设置参数
脚本名称为test.sh
if [ $1 == "root1" ] then m=m_1 v=v_1 elif [ $1 == "root2" ] then m=m_2 v=v_2 else echo "This Version is not exist, please check out." exit 0 fi
在执行脚本时则为
./test.sh root1 ./test.sh root2