% \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}