latex

File Read

The read file will be part of the PDF output.

latex '\documentclass{article}\usepackage{verbatim}\begin{document}\verbatiminput{/path/to/input-file}\end{document}'
strings texput.dvi

File Write

The file can only be written in the current directory, and the `.tex` extension is mandatory.

latex '\documentclass{article}\newwrite\tempfile\begin{document}\immediate\openout\tempfile=output-file.tex\immediate\write\tempfile{DATA}\immediate\closeout\tempfile\end{document}'

Shell

latex --shell-escape '\immediate\write18{/bin/sh}'