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