As David pointed out, you can use \write18
to call external programs, then \input
the resultant output file. However you will probably want to use \immediate\write18
to make sure the script is executed before calling the \input
.
Alternatively, if you use newer versions of pdf(la)tex (after 1.40, I think), you can pipe the output directly into the document, by using a piped input command:
\documentclass{article}
\begin{document}
\input{|"/usr/local/bin/my-shell-script.sh"}
\end{document}
For either method you will need to enable external program calls. For TeXlive distributions, you need to call latex with the -shell-escape
option, or for MikTeX, I believe the option is -enable-write18
.