2013/4/26 Cecil Westerhof
The following script does what I want: #!/usr/bin/env bash
set -o errexit set -o nounset
declare -r DEFAULT=cecil declare -r DIR=${HOME}/Documenten/CV declare -r FILE=CV-Cecil-Westerhof declare -r SCRIPTNAME=$(basename ${0})
declare RESULT declare TYPE
if [[ ${#} -ge 1 ]] ; then TYPE=${1}; shift else TYPE=${DEFAULT} fi readonly TYPE
if [[ ${#} -ne 0 ]] ; then echo "USAGE: ${SCRIPTNAME} [TYPE]" exit 1 fi
cd ${DIR} RESULT=${FILE} if [[ ${TYPE} != ${DEFAULT} ]] ; then RESULT+=-${TYPE} fi readonly RESULT
context --CVType=${TYPE} --result=${RESULT} CV-Cecil-Westerhof
There is only one problem. If I first generate the default one and after that a specific one, the default one does not exist anymore. I suppose that when --result is used, first the pdf with the same name as the tex file is generated and then moved. A little nuisance, but I can live with it.
That can be solved by renaming the tex-file to CV.tex. The script is now: #!/usr/bin/env bash set -o errexit set -o nounset declare -r DEFAULT=cecil declare -r DIR=${HOME}/Documenten/CV declare -r FILE=CV declare -r SCRIPTNAME=$(basename ${0}) declare RESULT=CV-Cecil-Westerhof declare TYPE if [[ ${#} -ge 1 ]] ; then TYPE=${1}; shift else TYPE=${DEFAULT} fi readonly TYPE if [[ ${#} -ne 0 ]] ; then echo "USAGE: ${SCRIPTNAME} [TYPE]" exit 1 fi cd ${DIR} if [[ ${TYPE} != ${DEFAULT} ]] ; then RESULT+=-${TYPE} fi readonly RESULT context --CVType=${TYPE} --result=${RESULT} ${FILE} -- Cecil Westerhof