# Calling and using output from a shell command

There are two things I would like to do but can't see how. First, I would like to input an uppercase version of \word using the elisp function upcase through emacsclient -e. I've written out a naïve and non-working attempt below. I don't know how to escape characters correctly, and I don't know how to expand \word as required.

\documentclass{article}
\usepackage{fontspec}
\usepackage{titlesec}

\begin{document}

\tableofcontents

\section{banana}

\def\word{straw}
\input{|"emacsclient -e "(upcase "\word")""}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% engine: luatex
%%% TeX-master: t
%%% End:


Secondly, I would like to use elisp upcase instead of \MakeUppercase in \titleformat.