monochromatic

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

commit 343fdb10c42faa707c2628b1d4849a3ee7cb84bd
parent cfa9f5529f6adcdad9081597441bb6ea62701dc3
Author: Willy Goiffon <w.goiffon@gmail.com>
Date:   Sun,  8 Sep 2013 22:59:52 +0200

Create a non-existing directory and test a few things

Diffstat:
tools/post.sh | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/post.sh b/tools/post.sh @@ -2,10 +2,17 @@ [[ -z "$1" ]] && exit 1 -POST="$(date +%Y)/$(date +%m)/${1// /-}.html" +folder=$(date +%Y/%m) +file=${1// /-}.html + +[[ ! -d ${folder} ]] && mkdir ${folder} + +POST="${folder}/${file}" cat tools/{head,body,foot}.template >> $POST -echo "$POST created" +[[ -f ${folder}/${file} ]] && echo "$POST created" && exit 0 + +echo "cannot create ${POST}"