forked from pyenv/pyenv.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecho-html-list.sh
More file actions
executable file
·46 lines (39 loc) · 898 Bytes
/
echo-html-list.sh
File metadata and controls
executable file
·46 lines (39 loc) · 898 Bytes
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
cd shells
previous_shell=""
previous_name=""
sha256sum *.* | while read -r line; do
file="${line##* }"
sha="${line%% *}"
name="${file}"
while [[ ! "${name##*.}" =~ [0-9]+ ]]; do
name="${name%.*}"
done
name="${name^}"
name="${name//-/ }"
if [ "${name}" = "${previous_name}" ]; then
echo "<li><a href=\"shells/${sha}\">${file}</a></li>"
else
if [ -n "${previous_name}" ]; then
echo "</ul>"
fi
shell="${file%%-*}"
if [ "${shell}" != "${previous_shell}" ]; then
if [ -n "${previous_shell}" ]; then
echo "</details>"
echo
fi
echo "<details>"
echo "<summary>${shell^}</summary>"
fi
echo
echo "<h3>${name}</h3>"
echo "<ul>"
echo "<li><a href=\"shells/${sha}\">${file}</a></li>"
fi
previous_shell="${shell}"
previous_name="${name}"
done
echo "</ul>"
echo
echo "</details>"