time=$(date +%Y%m%d) mkdir $time cd $time touch 0.txt touch 0.c touch 0.cc touch 0.cpp touch 0.h touch makefile touch 0.sh echo "#include<stdio.h>" >> 0.c echo "#include<stdlib.h>" >>0.c echo "void fun()" >> 0.c echo "{" >> 0.c echo " " >> 0.c echo "}" >> 0.c echo "int main()" >>0.c echo "{" >> 0.c echo "return 0; " >> 0.c echo "}" >> 0.c for s in $*;do echo $s >> 0.c done echo "#include<stdio.h>" >> 0.cc echo "#include<stdlib.h>" >>0.cc echo "#include<iostream>" >>0.cc echo "using namespace std;" >>0.cc echo "void fun()" >> 0.cc echo "{" >> 0.cc echo " " >> 0.cc echo "}" >> 0.cc echo "int main()" >>0.cc echo "{" >> 0.cc echo "return 0; " >> 0.c echo "}" >> 0.cc for s in $*;do echo $s >> 0.cc done echo "#include<stdio.h>" >> 0.cpp echo "#include<stdlib.h>" >>0.cpp echo "#include<iostream>" >>0.cpp echo "#using namespace std;" >>0.cpp echo "void fun()" >> 0.cpp echo "{" >> 0.cpp echo " " >> 0.cpp echo "}" >> 0.cpp echo "int main()" >>0.cpp echo "{" >> 0.cpp echo "return 0; " >> 0.cpp echo "}" >> 0.cpp for s in $*;do echo $s >> 0.cpp done echo "<<‘com‘ " >> 0.makefile echo " " >> 0.makefile echo "com " >> 0.makefile echo "##########" >> 0.makefile echo "wz:" >> 0.makefile echo " @g++ m *.cpp *.h" >> 0.makefile echo ".PHONY" >> 0.makefile echo "clean:" >> 0.makefile echo " @rm m" >> 0.makefile for s in $*;do echo $s >> 0.makefile done echo "#include<stdio.h>" >> 0.h echo "#include<stdlib.h>" >>0.h echo "#include<string.h>" >>0.h echo "#include<time.h>" >>0.h echo "#include<math.h>" >>0.h echo "#include<iostream>" >>0.h echo "#using namespace std;" >>0.h for s in $*;do echo $s >> 0.h done
原文地址:http://wzsts.blog.51cto.com/10251779/1831908