-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_week.sh
executable file
·71 lines (61 loc) · 1.61 KB
/
new_week.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
#/bin/sh
day=$(date +%A)
if [ $day == "토요일" ]; then
pre2=$(date -d '1 day ago' +%m-%d)
pre3=$(date -d '2 day ago' +%m-%d)
pre4=$(date -d '3 day ago' +%m-%d)
pre5=$(date -d '4 day ago' +%m-%d)
pre6=$(date -d '5 day ago' +%m-%d)
day1=$(date -d '2 day' +%m-%d)
day2=$(date -d '3 day' +%m-%d)
day3=$(date -d '4 day' +%m-%d)
day4=$(date -d '5 day' +%m-%d)
day5=$(date -d '6 day' +%m-%d)
fi
if [ $day == "일요일" ]; then
pre2=$(date -d '2 day ago' +%m-%d)
pre3=$(date -d '3 day ago' +%m-%d)
pre4=$(date -d '4 day ago' +%m-%d)
pre5=$(date -d '5 day ago' +%m-%d)
pre6=$(date -d '6 day ago' +%m-%d)
day1=$(date -d '1 day' +%m-%d)
day2=$(date -d '2 day' +%m-%d)
day3=$(date -d '3 day' +%m-%d)
day4=$(date -d '4 day' +%m-%d)
day5=$(date -d '5 day' +%m-%d)
fi
if [ $day == "월요일" ]; then
pre2=$(date -d '3 day ago' +%m-%d)
pre3=$(date -d '4 day ago' +%m-%d)
pre4=$(date -d '5 day ago' +%m-%d)
pre5=$(date -d '6 day ago' +%m-%d)
pre6=$(date -d '7 day ago' +%m-%d)
day1=$(date -d '0 day' +%m-%d)
day2=$(date -d '1 day' +%m-%d)
day3=$(date -d '2 day' +%m-%d)
day4=$(date -d '3 day' +%m-%d)
day5=$(date -d '4 day' +%m-%d)
fi
folder_name=To$pre6
echo "updating..."
git pull
if [ "$(ls ThisWeek | grep $day1)" != "$day1" ]; then
mkdir archive/$folder_name
mv ThisWeek/* archive/$folder_name
git add archive/*
for dayz in $day1 $day2 $day3 $day4 $day5
do
mkdir ThisWeek/$dayz
echo "" > ThisWeek/$dayz/.init
git add --all ThisWeek/$dayz
done
for prez in $pre2 $pre3 $pre4 $pre5 $pre6
do
git add --all ThisWeek/$prez/*
done
git commit -m "automatically generated"
git push origin master
exit 0
fi
echo "Hello World!"
exit