template_tex/tex/shell.tex

6 lines
252 B
TeX

% \getenv[\HOME]{HOME} % example: store $HOME shell var into \HOME cmd.
\usepackage{catchfile}
\newcommand{\getenv}[2][]{%
\CatchFileEdef{\temp}{"|kpsewhich --var-value #2"}{\endlinechar=-1}%
\if\relax\detokenize{#1}\relax\temp\else\let#1\temp\fi}