Problem and solution
I was hoping that this would be an available, but it's not! I've recently been doing some job applications and manually creating a new CV/cover letter each time is tedious.
My solution was to create a directory called "base" where base a cv and cover letter are stored.
The bash script is then saved in a different 'scripts' folder elsewhere. It has been named 'apply.sh'.
Code, examples, and file structure
An example of the creation of a new cv (or résumé) file:
apply.sh -r important_business_job
# creates...
~/.../your_job_applications_folder/cv_your_name_here_important_business_job.docx
The code I used is here:
# Takes a CV or cover letter and copies it with the role name changed.
#! /bin/bash
if getopts c:r: name
then
case $name in
c)OUTFILE= cover_letter_your_name_here_${OPTARG}.docx; INFILE=base/base_cover_letter.docx;;
r)OUTFILE=cv_your_name_here_${OPTARG}.docx; INFILE=base/base_cv.docx;;
*)echo "Invalid argument. Please select either 'r' for resume or 'c' for cover letter";;
esac
cp $INFILE $OUTFILE
else
echo "Please select the type of file to create (either 'r' for resume or 'c' for cover letter)"
fi
shift $(($OPTIND -1))
File structure:
your_job_applications_folder
├── base
│ ├── base_cover_letter.docx
│ └── base_cv.docx
└── NEW_FILES_GO_HERE
So, how does this relate to this post?
Using this same 'base' folder setup the code could be changed to copy a blank document from a base.docx document each time, effectively creating a new document. However, this may keep the original metadata...
file='new.odt'; touch "$file" && libreoffice "$file" &