diff --git a/src/freedombone-mesh-blog b/src/freedombone-mesh-blog index 7073f733..9602bf3c 100755 --- a/src/freedombone-mesh-blog +++ b/src/freedombone-mesh-blog @@ -105,7 +105,8 @@ function delete_blog { return fi CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX) - LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${CURRENT_INDEX}_post.rst + PREVIOUS_INDEX=$((CURRENT_INDEX - 1)) + LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.rst if [ ! -f $LAST_BLOG_ENTRY ]; then return fi @@ -118,8 +119,10 @@ function delete_blog { case $sel in 0) rm $LAST_BLOG_ENTRY if [ $CURRENT_INDEX -gt 0 ]; then - CURRENT_INDEX=$((CURRENT_INDEX - 1)) + CURRENT_INDEX=$PREVIOUS_INDEX echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX + else + rm -f $CURRENT_BLOG_INDEX fi regenerate_blog ;;