-
Notifications
You must be signed in to change notification settings - Fork 34
/
copy_readme.sh
54 lines (48 loc) · 1.11 KB
/
copy_readme.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
# github action akan trigger copy.sh untuk mengcopy beberapa section pada readme file portofolio
# ke readme johansenjunias20.github.io
COPY=FALSE
ENDCOPY=FALSE
txt=""
# first, remove section from readme johansenjunias.github.io
while read p; do
# underscore="_"
if [[ "$p" == *"<!-- COPY -->"* ]]; then
COPY=TRUE
fi
if [[ "$p" == *"<!-- ENDCOPY -->"* ]]; then
COPY=FALSE
continue
fi
if [ "$COPY" == "TRUE" ]; then
continue
fi
echo $p
done <../JohansenJunias20.github.io/readme.md >o # put in o file
ls
pwd
o="$(cat o)"
echo $o
rm -f o # remove o file
# reset variable
COPY=FALSE
ENDCOPY=FALSE
while read p; do
if [[ "$p" == *"<!-- COPY -->"* ]]; then
COPY=TRUE
fi
if [[ "$p" == *"<!-- ENDCOPY -->"* ]]; then
ENDCOPY=TRUE
COPY=FALSE
fi
if [ "$COPY" == "TRUE" ]; then
txt="$txt\n"
txt="$txt$p"
fi
if [ "$ENDCOPY" == "TRUE" ]; then
txt="$txt\n"
txt="$txt$p" # copy the ENDCOPY tag
break
fi
done \
<readme.md
echo -e "$o\n$txt" >../JohansenJunias20.github.io/readme.md