-
Notifications
You must be signed in to change notification settings - Fork 5
/
generate_readme.sh
41 lines (35 loc) · 1.16 KB
/
generate_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
#!/bin/bash
declare -A names
names=( ["gcj"]="Google Code Jam" ["codility"]="Codility" ["kattis"]="Kattis" ["hacker_rank"]="Hacker Rank")
folders=("gcj" "codility" "kattis" "hacker_rank")
printf "#Algorithms playground\n"
printf "\n"
printf "Project containing solutions to various algorithmic problems.\n"
printf "\n"
printf "Problem web-sites:\n"
printf "* [Googe Code Jam](http://code.google.com/codejam/)\n"
printf "* [Codility](https://codility.com/train/)\n"
printf "* [Spoj](http://www.spoj.com/)\n"
printf "* [Codeforces](http://codeforces.com/)\n"
printf "* [Kattis](https://open.kattis.com/)\n"
printf "\n"
printf "#Solved problems:\n"
printf "\n\n"
for folder in ${folders[*]};
do
name=${names[$folder]}
printf "* ##%s\n" "$name"
for file in $(find $folder/);
do
#echo $file
if [ -d "${file}" ] ; then
continue
fi
first_line=$(grep "link:" $file)
second_line=$(grep "name:" $file)
link=${first_line##*link:}
name=${second_line##*name:}
printf " * [%s](%s) ([source](%s))\n" "${name## }" "${link## }" "$file"
done;
printf "\n\n"
done;