Permalink
Browse files

Added checks if directories exist

  • Loading branch information...
1 parent 512792f commit c81e129a0224d365935d15c34ce8d9b14ee87d9c @qbi qbi committed Oct 30, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/convert_to_tex.sh
View
@@ -4,7 +4,10 @@ if [ -z $1 ] ; then
else
DIR=$1
fi
-mkdir $DIR
+
+if [ ! -d $DIR ] ; then
+ mkdir $DIR
+fi
cat > $DIR/main.tex <<EOF
\documentclass[oribibl,a4paper]{book}
@@ -31,7 +34,9 @@ EOF
for d in chapter*; do
- mkdir $DIR/$d
+ if [ ! -d $DIR/$d ] ; then
+ mkdir $DIR/$d
+ fi
echo "\\graphicspath{{./$d/}}" >> $DIR/main.tex
title=`echo $d | sed 's/chapter_[0-9][0-9]_//; s/_/ /g; s/^./\U&/; s/ ./\U&/g'`
echo "\\chapter{$title}" >> $DIR/main.tex

0 comments on commit c81e129

Please sign in to comment.