-
Notifications
You must be signed in to change notification settings - Fork 0
/
prep.sh
executable file
·83 lines (63 loc) · 1.68 KB
/
prep.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
73
74
75
76
77
78
79
80
81
82
83
#!/bin/env bash
# .gitignore
# Makefile
# inc/bitmap_image.h
# inc/color.h
# inc/light.h
# inc/object.h
# inc/vector.h
# scene.txt
# scene_guide.txt
# specs.pdf
# src/color.cpp
# src/light.cpp
# src/main.cpp
# src/object.cpp
# src/vector.cpp
rm -rf 1605018/
mkdir 1605018
# cp inc/bitmap_image.h 1605018/bitmap_image.hpp
# cp scene.txt 1605018/
FILE="1605018/1605018_header.h"
rm -f "$FILE"
touch "$FILE"
FN="inc/vector.h"
LN=$(wc -l "$FN" | awk '{print $1}')
LN=$((LN - 2))
sed -n -e "3,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="inc/color.h"
LN=$(wc -l "$FN" | awk '{print $1}')
LN=$((LN - 2))
sed -n -e "3,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="inc/light.h"
LN=$(wc -l "$FN" | awk '{print $1}')
LN=$((LN - 2))
sed -n -e "3,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="inc/object.h"
LN=$(wc -l "$FN" | awk '{print $1}')
LN=$((LN - 2))
sed -n -e "3,$LN p" -e "$LN q" "$FN" >> "$FILE"
sed -i '/#include ".*\.h"/d' "$FILE"
FILE="1605018/1605018_main.cpp"
rm -f "$FILE"
touch "$FILE"
FN="src/vector.cpp"
LN=$(wc -l "$FN" | awk '{print $1}')
sed -n -e "1,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="src/color.cpp"
LN=$(wc -l "$FN" | awk '{print $1}')
sed -n -e "1,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="src/light.cpp"
LN=$(wc -l "$FN" | awk '{print $1}')
sed -n -e "1,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="src/object.cpp"
LN=$(wc -l "$FN" | awk '{print $1}')
sed -n -e "1,$LN p" -e "$LN q" "$FN" >> "$FILE"
FN="src/main.cpp"
LN=$(wc -l "$FN" | awk '{print $1}')
sed -n -e "1,$LN p" -e "$LN q" "$FN" >> "$FILE"
sed -i '/#include ".*\.h"/d' "$FILE"
sed -i '1s/^/#include "1605018_header.h"\n/' "$FILE"
sed -i '1s/^/#include "bitmap_image.hpp"\n/' "$FILE"
zip -r 1605018.zip 1605018/
mv 1605018.zip /home/enan/Downloads/