debugDir = "/debugExamples" releaseDir = "/releaseExamples" docDir="../../../mew_devdata/interfaceDoc/" for path in `ls` do if test -d $path then echo ‘test package ‘$path cd $path ./test.sh cd .. rm -r $docDir$path$debugDir rm -r $docDir$path$releaseDir cp -r $path$debugDir $docDir$path cp -r $path$releaseDir $docDir$path sleep 3s fi done
这里定义变量时加了空格,然后定义变量失败,$debugDir直接就为空,结果把我几个文件夹给删了,早上写的代码没有git add,全没了。。。
所以以后写脚本,运行的时候一定要先将代码保存
debugDir="/debugExamples" releaseDir="/releaseExamples" docDir="../../../mew_devdata/interfaceDoc/" for path in `ls` do if test -d $path then echo ‘test package ‘$path cd $path ./test.sh cd .. rm -r $docDir$path$debugDir rm -r $docDir$path$releaseDir cp -r $path$debugDir $docDir$path cp -r $path$releaseDir $docDir$path sleep 3s fi done
时间: 2024-11-12 21:52:03