monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

commit 0ffecc513f57f6f92d3250aa6966d114589e850e
parent 2684a7305835d91a5db1fbab59fca106b5db2b1a
Author: z3bra <willy@mailoo.org>
Date:   Mon,  3 Feb 2014 16:27:59 +0100

Fixed the script to create new posts

Diffstat:
tools/post.sh | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/tools/post.sh b/tools/post.sh @@ -3,13 +3,16 @@ # Ask the user for a title -read -p "post title" title +read -p "Post title: " title + # use post title to name the file -file=`echo ${title}| sed "s/\s\+/-/g;s/./\l&/g;s/[,.!;\"']/g"` +file=`echo ${title}| sed "s/\s\+/-/g;s/./\l&/g;s/[,.!;\"']//g"`.html + +test -z "$file" && exit 1 #date format for the post -date=`date +%d %B, %Y` +date=`date +"%d %B, %Y"` # The format of the path to the post, here: /yyyy/mm/ folder=`date +%Y/%m` @@ -24,9 +27,9 @@ post="${folder}/${file}" cat tools/{head,body,foot}.template >> ${post} # put the title and date in the post -sed "s/BLOG_TITLE/${title};s/BLOG_DATE/${date}" +sed -i "s/BLOG_TITLE/${title}/;s/BLOG_DATE/${date}/" ${post} -test -f ${folder}/${file} || echo "cannot create ${post}" && exit 1 +test -f ${post} || echo "cannot create ${post}" && exit 1 echo "$post created"