Question: ```latex
\verbatiminput{|"echo foo"}

```

produces `foo`, wrapped in verbatim.
Is it possible to do the same with Minted’s syntax highlighting?
I have tried

```latex
\begin{minted}[escapeinside=!]{text}
!\verbatiminput{|"echo foo"}!
\end{minted}

```

but it didn’t work.
I also tried

```latex
\inputminted{text}{|"echo foo"}

```

but it gave an error of

```
(./_minted-report/friendly.pygstyle)sh: line 1: echo foo: command not found

```

Answer: 
It would be `\inputminted` but unlike `\verbatiminput` or even `listings`, the filename has to be passed to other programs notably `pygmentize` so I suspect it would take a lot of work to make that all work with the fake pipe syntax.

What you can do is use `\write18` to execute the command, saving to a temporary file, then use `\inputminted` on that, so for example:

```
\immediate\write18{echo foo > /tmp/cmd_out.txt}
\inputminted{text}{/tmp/cmd_out.txt}

```
You can use my [`iexec`](https://ctan.org/pkg/iexec) package, which will do the same as `\write18`, but will also check the exit code of the command:

```
\documentclass{article}
\usepackage{iexec}
\begin{document}
\iexec[quiet,trace,stdout=out.txt]{echo foo}
\inputminted{text}{out.txt}
\end{document}

```

Here, `quiet` means that we don't need to `\input` the output of the command to the TeX document; `trace` means that we should leave the output file `out.txt` untouched after the execution is finished (it's deleted by default); `stdout` allows you to configure the name of the file.

You can also use `stderr` for the file with standard error stream, and there are more options in the package, see [the doc](https://ctan.org/pkg/iexec).