Fixed broken indexing

This commit is contained in:
2020-06-08 19:24:33 +08:00
parent 87f16a231c
commit 1b7802f36a

View File

@ -4,7 +4,7 @@
# build the blog files # build the blog files
cd ../blog cd ../blog
CONTENTNUM=$(ls content-* | wc -l ) CONTENTNUM=$(($(ls content-* | wc -l)-1))
for ((i=-1;i<$CONTENTNUM;i++)) for ((i=-1;i<$CONTENTNUM;i++))
do do
padint="$(printf %03d $i)" padint="$(printf %03d $i)"
@ -14,10 +14,10 @@ do
blogname="blog-$padint" blogname="blog-$padint"
# interactive tail # interactive tail
if [[ $i >= 0 ]];then if (( $i >= 0 )) ;then
cp filetail "$tailname" cp filetail "$tailname"
padintprev="$(printf %03d $(($i - 1)) )" padintprev="$(printf %03d $(($i - 1)) )"
if [[ $(($i+1)) == $CONTENTNUM ]];then if (( $(($i+1)) == $CONTENTNUM )) ;then
padintnext="$(printf %03d -1 )" padintnext="$(printf %03d -1 )"
else else
padintnext="$(printf %03d $(($i + 1)) )" padintnext="$(printf %03d $(($i + 1)) )"
@ -27,13 +27,15 @@ do
fi fi
# cat together # cat together
cat filehead "$contentname" "$tailname" "$quotename" > "$blogname" if [[ -f $contentname ]] ;then
cat filehead "$contentname" "$tailname" "$quotename" > "$blogname"
fi
done done
# clean up non prod files # clean up non prod files
cd ../blog cd ../blog
#rm filehead filetail content* quote* .blog.* tail* rm filehead filetail content* quote* .blog.* tail*
cd ../ cd ../
#rm -rf .git scripts .index.html.* README.md rm -rf .git scripts .index.html.* README.md
find . -type f | xargs chmod 600 find . -type f | xargs chmod 600
find . -type d | xargs chmod 700 find . -type d | xargs chmod 700