-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.sh
executable file
·72 lines (64 loc) · 1.08 KB
/
model.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh
dirname=$1
name=$2
if [ $# != 2 ] ; then
echo "USAGE: ./model.sh dirname projectname"
exit 1;
fi
if [-d "$dirname"];then
echo "$dirname found..."
else
echo "$dirname not found..."
echo "mkdir $name..."
mkdir "$dirname"
fi
cd "$dirname"
if [ -d "$name" ]; then
echo "$name is existing..."
exit 1;
else
mkdir "$name"
cd "$name"
codefile=$name".cpp"
testfile=$name".txt"
objfile=$name".o"
makefile="Makefile"
touch $makefile
touch $codefile
touch $testfile
echo "a : $objfile
g++ -o a $objfile
$objfile : $codefile
g++ -c $codefile
.PHONY : clean
clean :
rm $objfile a
">>$makefile
echo "#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<fstream>
//#include<sstream>
using namespace std;
#define Debug
//************For Debug********
#ifdef Debug
ifstream fin(\"$testfile\");
#define in fin
#else
#define in cin
#endif
//******************************
#define MZ(a) memset(a,0,sizeof(a));
#define MF(a) memset(a,-1,sizeof(a));
int main()
{
cout<<\"hello\"<<endl;
return 0;
}
">>$codefile
vim $testfile
vim $codefile
fi