shell 访问 自定义参数

#!/bin/sh

# dir model dirs
builddir() {
	strdir=$1
	model=$2
	echo build $strdir
	cd $strdir
	rm -f CMakeLists.txt
	echo "# CMakeLists file">>CMakeLists.txt
	echo "">>CMakeLists.txt
	echo "add_library(net  ">>CMakeLists.txt
	array=$@
	OLD_IFS="$IFS"
	IFS=" "
	arr=($array)
	IFS="$OLD_IFS"
	for((i=2;i<$#;i++));do
		echo "	"${arr[$i]}
		ls ${arr[$i]}/*.cpp>>CMakeLists.txt
	done
	ls *.cpp>>CMakeLists.txt
	echo ")">>CMakeLists.txt
	cd ..
}

builddir net net 
builddir common common xml json 
builddir event event 
builddir gamed game  event
builddir logic logic 
builddir worldd world event 
builddir star star event 
builddir fight fight event
相关文章
相关标签/搜索