#!/bin/bash cur=`pwd` cd ~/ homedir=`pwd` path="${homedir}/Documents/texassets" # First we will deploy the texassets directory echo "Deploying assets folder. This will let you compile the latex templates" if [[ -f $path ]] then echo "Path already exists, exiting" exit fi if [[ -d ${path} ]] then echo "Path already exists but is file, copying files" else echo "Path does not exist, making new folder and copying files" mkdir ${path} fi cd $cur cp "${cur}/assets/"*.png ${path} echo "done" # Now we modify the template files so that they point to the right directory echo "Modifying the template files" for file in `ls | grep .tex` do sed -r "s/^### Insert graphicspath command here ###/\\\graphicspath {$path}/" -i $file done echo "done"