I build out-of-source with
pdflatex -output-dir=/foo
One of my macros generates temporary files in the working directory.
\immediate\write18{bash -c "some-command >outputfile"}
I want it to save them to the output directory instead.
How can I make my macro aware of the value given to the -output-dir command-line option?

pdflatex -output-directory=./foo "\def\outputdir{./foo}\input{myfile}"and, in the document, you will have\outputdiravailable. – egreg Feb 02 '17 at 11:32-output-dirit is much easier just to use the default output then move the generated files afterwards. – David Carlisle Feb 02 '17 at 11:34pdflatexand setupTEXINPUTSto find the files in your git repository directory? – Schweinebacke Feb 02 '17 at 12:00--output-dirdoesn't make the output directory an input directory (as far a TeX is concerned, all accessible files are 'here'). That's before you get to other tools ... – Joseph Wright Feb 02 '17 at 13:52