Fixed functions which required the presence of any html files (tar, rm,

etc). Closes #8, thanks to Newky for the report.
This commit is contained in:
Carlos Fenollosa 2013-03-13 09:16:44 +01:00
parent 9710192b70
commit 7b83de54e1

17
bb.sh
View File

@ -420,6 +420,12 @@ rebuild_index() {
# Displays a list of the posts # Displays a list of the posts
list_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="" lines=""
n=1 n=1
for i in $(ls -t *.html); do 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!\" " echo "Are you sure you want to delete all blog entries? Please write \"Yes, I am!\" "
read line read line
if [ "$line" == "Yes, I am!" ]; then 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 "Deleted all posts, stylesheets and feeds."
echo "Kept your old '.backup.tar.gz' just in case, please delete it manually if needed."
else else
echo "Phew! You dodged a bullet there. Nothing was modified." echo "Phew! You dodged a bullet there. Nothing was modified."
fi fi
@ -638,8 +646,11 @@ do_main() {
fi fi
# We're going to back up just in case # We're going to back up just in case
tar cfz ".backup.tar.gz" *.html ls *.html &> /dev/null
chmod 600 ".backup.tar.gz" if [[ $? -eq 0 ]]; then
tar cfz ".backup.tar.gz" *.html
chmod 600 ".backup.tar.gz"
fi
if [ "$1" == "reset" ]; then if [ "$1" == "reset" ]; then
reset reset