-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_index.sh
executable file
·47 lines (41 loc) · 930 Bytes
/
gen_index.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
#!/bin/bash
cat << EOF > index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<h3>Tweet Archive</h3>
<style>
body {
font-family: "Helvetica", sans-serif;
background-color: #000000;
}
h3 {
color: white;
font-weight: 250;
}
a {
font-family: "Helvetica", sans-serif;
color: cyan;
}
a:visited {
color: purple;
}
</style>
</head>
<body>
<ul id="subdirectories-list">
EOF
for dir in $(ls -d */ | tac); do
subdir=$(basename "$dir")
if [ -f "${dir}index.html" ]; then
echo " <li><a href=\"$dir/index.html\">$subdir</a></li>" >> index.html
fi
done
cat << EOF >> index.html
</ul>
</body>
</html>
EOF
echo "Archive formatted successfully."