I want define a command "\foo" which outputs the result of a shell command, such as:
\newcommand{\foo}[1]{\input{|"#1"}}
This works, except if I'm trying to use this command in the context of \includegraphics:
\includegraphics{\foo{command attr1 attr2}}
where command is a shell command which outputs a filename. For example, with command: "echo im" and im.png an image on the same directory, I get this error:
! Undefined control sequence.
\filename@simple ...#2\\}\fi \edef \filename@base
{#1}
l.14 \includegraphics{\foo{echo im}}
\includegraphicsShellcommand which works like\includegraphicsShell{echo up}, so this is acceptable. Only one limitation for now, I have issues with escaping my shell command (For example, if I need to do\foo{python -c "code with 'strings'"}, it interact with the \input command. – Guillaum Dec 18 '13 at 17:23\input{xxx}in the tex file and don't need --shell-escape – David Carlisle Dec 18 '13 at 17:31