Build interactive tail
This commit is contained in:
@ -5,13 +5,36 @@
|
|||||||
# build the blog files
|
# build the blog files
|
||||||
cd ../blog
|
cd ../blog
|
||||||
CONTENTNUM=$(ls content-* | wc -l )
|
CONTENTNUM=$(ls content-* | wc -l )
|
||||||
for ((i=0;i<=$CONTENTNUM;i++))
|
for ((i=0;i<$CONTENTNUM;i++))
|
||||||
do
|
do
|
||||||
cat filehead "content-$(printf %03d $i)" "quote-$(printf %03d $i)" > blog-00$i
|
padint="$(printf %03d $i)"
|
||||||
|
contentname="content-$padint"
|
||||||
|
quotename="quote-$padint"
|
||||||
|
tailname="tail-$padint"
|
||||||
|
blogname="blog-$padint"
|
||||||
|
|
||||||
|
# interactive tail
|
||||||
|
cp filetail "$tailname"
|
||||||
|
if [[ $i > 0 ]];then
|
||||||
|
padintprev="$(printf %03d $(($i - 1)) )"
|
||||||
|
else
|
||||||
|
padintprev="$(printf %03d 0 )"
|
||||||
|
fi
|
||||||
|
if [[ $(($i+1)) == $CONTENTNUM ]];then
|
||||||
|
padintnext="$(printf %03d 0 )"
|
||||||
|
else
|
||||||
|
padintnext="$(printf %03d $(($i + 1)) )"
|
||||||
|
fi
|
||||||
|
sed -i "s/PREVPADINT/$padintprev/g" "$tailname"
|
||||||
|
sed -i "s/NEXTPADINT/$padintnext/g" "$tailname"
|
||||||
|
|
||||||
|
# cat together
|
||||||
|
cat filehead "$contentname" "$tailname" "$quotename" > "$blogname"
|
||||||
done
|
done
|
||||||
rm filehead content* quote* .blog.*
|
|
||||||
|
|
||||||
# clean up non prod files
|
# clean up non prod files
|
||||||
|
cd ../blog
|
||||||
|
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
|
||||||
|
Reference in New Issue
Block a user