From 7b83de54e1a4a968fca6d7000f5d621fa348b4f8 Mon Sep 17 00:00:00 2001 From: Carlos Fenollosa Date: Wed, 13 Mar 2013 09:16:44 +0100 Subject: [PATCH 1/2] Fixed functions which required the presence of any html files (tar, rm, etc). Closes #8, thanks to Newky for the report. --- bb.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/bb.sh b/bb.sh index 3380c98..2b67d4f 100755 --- a/bb.sh +++ b/bb.sh @@ -420,6 +420,12 @@ rebuild_index() { # Displays a list of the posts list_posts() { + ls *.html &> /dev/null + if [[ $? -ne 0 ]]; then + echo "No posts yet. Use 'bb.sh post' to create one" + return + fi + lines="" n=1 for i in $(ls -t *.html); do @@ -592,8 +598,10 @@ reset() { echo "Are you sure you want to delete all blog entries? Please write \"Yes, I am!\" " read line if [ "$line" == "Yes, I am!" ]; then - rm "*.html" "*.css" "*.rss" + rm .*.html *.html *.css *.rss &> /dev/null + echo echo "Deleted all posts, stylesheets and feeds." + echo "Kept your old '.backup.tar.gz' just in case, please delete it manually if needed." else echo "Phew! You dodged a bullet there. Nothing was modified." fi @@ -638,8 +646,11 @@ do_main() { fi # We're going to back up just in case - tar cfz ".backup.tar.gz" *.html - chmod 600 ".backup.tar.gz" + ls *.html &> /dev/null + if [[ $? -eq 0 ]]; then + tar cfz ".backup.tar.gz" *.html + chmod 600 ".backup.tar.gz" + fi if [ "$1" == "reset" ]; then reset From 853b56bf301b5f3ac85e092be69a6099ac145051 Mon Sep 17 00:00:00 2001 From: dasistdaniel Date: Fri, 29 Mar 2013 08:17:35 +0100 Subject: [PATCH 2/2] bugfixes New Twitter Comment Template "View more Posts" Template Fix --- bb.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bb.sh b/bb.sh index c9101e4..1c5b9fc 100755 --- a/bb.sh +++ b/bb.sh @@ -142,6 +142,9 @@ global_variables() { template_subscribe_browser_button="Subscribe to this page..." # "Tweet" (used as twitter text button for posting to twitter) template_twitter_button="Tweet" + + template_twitter_comment="<Type your comment here but please leave the URL so that other people can follow the comments>" + # The locale to use for the dates displayed on screen (not for the timestamps) date_format="%B %d, %Y" date_locale="C" @@ -185,7 +188,7 @@ edit() { # $1 the post URL twitter() { echo "

$template_comments  " - echo "View more posts'$template_subscribe'' >> "$contentfile" + echo '

' >> "$contentfile" else echo '' >> "$contentfile" fi