2013/4/26 Cecil Westerhof <cldwester...@gmail.com>:
> 2013/4/26 Hans Hagen <pra...@wxs.nl>:
>> On 4/26/2013 7:01 PM, Cecil Westerhof wrote:
>>>
>>> 2013/4/26 Hans Hagen <pra...@wxs.nl>:
>>>>
>>>> On 4/26/2013 6:50 PM, Cecil Westerhof wrote:
>>>>>
>>>>>
>>>>> 2013/4/26 Hans Hagen <pra...@wxs.nl>:
>>>>>>
>>>>>>
>>>>>> On 4/26/2013 5:34 PM, Cecil Westerhof wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I am using a command line parameter to change the generated output. Is
>>>>>>> it also possible to set the output file name depending on the
>>>>>>> parameter?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --result=somename
>>>>>
>>>>>
>>>>>
>>>>> That is on the command line. Then you need to give two parameters. Not
>>>>> a very big problem, but I would prefer one parameter. I like DRY. Less
>>>>> that can go wrong.
>>>>
>>>>
>>>>
>>>> not possible but you can access the outputfilename at the tex and lua end
>>>
>>>
>>> What do mean with that?
>>
>>
>> just grep for outputfile in lua and mkiv files
>
> I have now (I need to use jobfilename, because I get an error when I
> use outputfilename):
>     \def\outputfilename{\jobfilename -\getvariable{meta}{type}}
>     \def\outputfilenametwo{\jobfilename -\getvariable{meta}{type}}
>
> When displaying outputfilenametwo I see that it is filled with the
> correct value, but the output is still written to the same file.

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.

-- 
Cecil Westerhof
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to