From d6866b78320453387854ae1ab5abe0be79415ec4 Mon Sep 17 00:00:00 2001 From: "taha@asks2" Date: Sat, 5 Sep 2020 01:30:49 +0200 Subject: [PATCH] files in assets/references/ actually need to be overwritten since they are bibtex libraries which often change on disk and this copying is how we update the thesis's copy of them --- chertex.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chertex.sh b/chertex.sh index 3dd4372..59d8725 100755 --- a/chertex.sh +++ b/chertex.sh @@ -138,9 +138,15 @@ if [ $# -eq 1 ]; then # https://stackoverflow.com/questions/10929453/read-a-file-line-by-line-assigning-the-value-to-a-variable while IFS='' read -r asset || [[ -n "$asset" ]]; do assetpathtarget=$(dirname "$externalfilepath") - echo "Copying $asset to $assetpathtarget" - # cp but don't overwwrite existing files + echo " Copying $asset to $assetpathtarget" + # cp but don't overwrite existing files cp --preserve=timestamps --no-clobber $asset $assetpathtarget + # except we want to overwrite the BibTeX library files (inside the assets/references/ directory), we'll do that by checking the target dirname and only running the destructive cp operation if its "references" + assetdirnametarget=$(basename "$assetpathtarget") + if [[ $assetdirnametarget == "references" ]]; then + echo " Overwriting BibTeX libraries in assets/references/" + cp --preserve=timestamps $asset $assetpathtarget + fi done < "$externalfilepath" done