blob: e77f85ff6dc4c263b36020e63aebc315bc176549 (
plain) (
blame)
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
|
#!/bin/sh
blogs=$(ls -ct1 blog/*.html)
blogs5=$(ls -ct1 blog/*.html | head -5)
date() {
ls -ct1l --time-style=+'%Y %b %d' $1 | cut -d ' ' -f 6-8
}
# delete old bloglist
sed -i -n '1,/ <p> <!-- script marker blog -->/p;/ <\/p> <!-- script marker blog -->/,$p' index.html
sed -i -n '1,/ <p> <!-- script marker blog -->/p;/ <\/p> <!-- script marker blog -->/,$p' blog.html
# top 5 blogs
for i in $blogs5; do
name=$(echo $i | sed 's/blog\///' | sed 's/\..*//' | sed 's/-/ /g')
line="<a href=\"https://squi.bid/$(echo $i | sed 's/\.html//')\">$name</a> [$(date $i)]<br>"
# add new bloglist
sed -i "/\ <\/p> <!-- script marker blog -->/i $line" index.html
done
# full blog
for i in $blogs; do
name=$(echo $i | sed 's/blog\///' | sed 's/\..*//' | sed 's/-/ /g')
line="<a href=\"https://squi.bid/$(echo $i | sed 's/\.html//')\">$name<span id=\"date\">$(date $i)</span></a><br>"
# add new bloglist
sed -i "/ <\/p> <!-- script marker blog -->/i $line" blog.html
done
|